← Problem book: C Lesson 62 of 96 · 15 XP

Second maximum

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

The first line contains the count of numbers n (n ≥ 2), the second — the n integers themselves, separated by spaces.

Print the second largest number — the one that comes second if the numbers are sorted in descending order (for 5 5 3 the second largest is 5).

Example

Input:

5
3 9 7 1 8

Output:

8

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.