eolymp
bolt
Try our new interface for solving problems
Problems

Silver medal

Silver medal

Vasiliy athlete competed in hokkeybol and got in the individual event silver medal. It is known that participants who scored the same number of points will be awarded the same awards. We also know that were raffled off with gold, silver and bronze medals. In this problem we do not ask the hokkeybol rules. You only need to determine how many points were scored by Vasiliy.

Input

The first line contains the number of athletes n (2n1000) participating in competitions. In the second line n integers are given - the results of competition.

Output

Print one number - the result of Vasiliy.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
4 3 3 1 2 
Output example #1
3
Source Stage II Ukrainian School Olympiad 2011-2012, Berdichev