Second Largest

MediumGrade 11

Read an array of distinct integers and print the second-largest value.

Input / Output

Input: first line N (N ≥ 2), second line N distinct space-separated integers. Output: the second-largest value.

Examples

Input

5
3 7 2 9 4

Expected Output

7

Input

4
10 20 30 40

Expected Output

30

+ 2 hidden tests checked on Submit.

Files

Main.java is the entry point. Add extra classes for OOP exercises — they compile together.

Main.java
Loading...

Run your code to see test results here.