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

Marathon weekend with restrictions


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!


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.


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 1 6 5 9
Output example #1
1 9
Input example #2
Output example #2
Input example #3
30000 30000
Output example #3
30000 30000
Source Stage II All-Ukrainian Olympiad 2010-2011 Berdichev