Hide

Problem D
Hitastig

Languages en is
/problems/hitastig/file/statement/en/img-0001.jpg
Image from flickr.com
Professor Hannes is a hard working man. His interests involve temperature, spending quite a bit of time looking into it. He finds it very interesting when the temperature is very high or very low. Really, he finds almost everything related to temperature very interesting, very interesting indeed!

The last $n$ days Hannes has been recording temperatures. Now it’s time to review the data and find interesting things. Hannes finds it interesting to know the highest and lowest temperature. He starts by looking at the data and tries to figure out the lowest and highest, but wooow that is a lot of data. There’s no way he can do this by hand.

Can you help Hannes find the highest and lowest temperatures from the last $n$ days?

Input

The input is on two lines. The first line contains a single integer $1 \le n \le 1\, 000$. The second line contains $n$ integers $-10^{18} \le a_i \le 10^{18}$, where $a_i$ denotes the temperature on the $i$-th day.

Output

Print two integers, first the highest temperature and then the lowest temperature from the last $n$ days.

Scoring

Group

Points

Constraints

1

80

$-10^9 \le a_i \le 10^9 $

2

20

No further constraints

Sample Input 1 Sample Output 1
7
-3 -2 -1 0 1 2 3
3 -3
Sample Input 2 Sample Output 2
1
1
1 1

Please log in to submit a solution to this problem

Log in