题目描述
Problem Description
I am a billionaire. I have so much money that I could be considered a tycoon. I can buy almost anything I want with this surplus of money. However, no matter how much money I have, it cannot buy human hearts. No matter how much money I have, if I were to incur the resentment of the masses, it would be difficult for me to live as I have been.
This time, to understand the feelings of the common people, I visited a family restaurant for the first time. When I opened the menu and checked the dishes and their prices, I was indeed surprised by how cheap they were. The price of each dish was negligible, so I thought about choosing the most expensive one.
However, thinking about it, why did I come to a family restaurant in the first place? To understand the feelings of the common people, choosing the most expensive dish without considering the price doesn't make any sense. If I were to order the most expensive dish blatantly, it could spread my bad reputation.
Nevertheless, I do want to try the taste of the more expensive dishes. If that's the case, I should order the second most expensive dish in this restaurant. I started listing the prices of the dishes, but due to the large variety, finding the second most expensive one is quite tedious. Instead of searching myself, can I write a program to do it?
Oh, one more thing before I start writing the program: Be careful when there are multiple dishes with the highest price. For example, if there are four dishes with prices of 100 yen, 200 yen, 300 yen, and 300 yen, the second most expensive dish would be the one priced at 200 yen.
Input Format
The input is given from the standard input in the following format:
$ N $ $ A_1 $ $ A_2 $ : $ A_N $
- The first line contains an integer $ N $ ($2\ ≦\ N\ ≦\ 100$), representing the number of types of dishes.
- The next $ N $ lines contain the prices of each dish. The $ i $-th line contains an integer $ A_i $ ($1\ ≦\ A_i\ ≦\ 1,000$), indicating that the price of the $ i $-th dish is $ A_i $ yen. All dish prices are unique.
Output Format
Output the price of the second most expensive dish among the $ N $ dishes in one line.
Ensure to include a newline at the end of the output.
Sample Input and Output
Sample Input #1
4
100
200
300
300
Sample Output #1
200
Sample Input #2
5
50
370
819
433
120
Sample Output #2
433
Sample Input #3
6
100
100
100
200
200
200
Sample Output #3
100
Notes/Hints
Sample Explanation 1
This is the example mentioned in the problem statement. In this case, the most expensive dish is 300 yen, and the second most expensive dish is the one priced at 200 yen.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分