e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Marathon weekend with restrictions

Watermelons

Ivan Vasilyevich came to the market and decided to buy two watermelons: one for himself and another for the wife's mother. It is clear to choose for himself the heaviest watermelon, and for mother-in-law the lightest. But there is one problem: there are many watermelons and he does not know how to choose the lightest and the heaviest one. Help him!

Input

The first line contains the number of watermelons n (n30000). The second line contains n numbers, each number is a mass of corresponding watermelon. All weights of watermelons are positive integers and do not exceed 30000.

Output

Print two numbers: the weight of watermelon that Ivan Vasilyevich will buy for his mother-in-law and the weight of watermelon that he will buy himself, or print the message "Ooops!" (without quotes), if someone left without watermelon.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
5 1 6 5 9
Output example #1
1 9
Input example #2
1
5
Output example #2
Ooops!
Input example #3
2
30000 30000
Output example #3
30000 30000
Source Stage II All-Ukrainian Olympiad 2010-2011 Berdichev