In the class quiz, the topper gets a gold medal and the second-highest scorer gets silver. If many students tie, they share the same medal, so we need the second highest distinct score.
If there is no second distinct score (all scores are the same), print -1.
Input Format The first line has n. The second line has n scores.
Output Format Print the second highest distinct score, or -1.
Constraints • 1 ≤ n ≤ 1000 • 0 ≤ score ≤ 100
Examples
Example 1
Input
5
78 92 85 92 60
Output
85
Explanation Highest is 92 (twice). The next distinct score is 85.
Example 2
Input
3
50 50 50
Output
-1
Explanation All equal, so there is no second highest.
Example 3
Input
2
0 100
Output
0
Explanation 100 is first and 0 is second.
Example 4
Input
1
77
Output
-1
Explanation Only one student, so -1.
Acceptance—
Accepted0
Submissions0
Auto-save
SavedLn 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
85
No results yet
Run your code to test it against the sample cases.