Skip to lesson

A easy problem for practising 5.4 Array & String Techniques. Solve it in your own IDE, check it against every test, and open a hint only when you are stuck. 0/1 solved.

1. Second highest score

easy

A class teacher has the test scores of n students. Print the second highest different score. If all students have the same score, there is no second highest score, so print -1.

Input: The first line has one integer n. The second line has n integers: the scores, separated by spaces.

Output: One integer: the second highest different score, or -1 if it does not exist.

Limits: 1 ≤ n ≤ 10^5 · 0 ≤ score ≤ 100

Example 1

Input

5
70 85 92 85 60

Output

85

92 is the highest. The next different score is 85.

Example 2

Input

3
50 50 50

Output

-1

Every score is the same, so there is no second highest.

Submit to solve