#C2429. Second Highest Unique Element

    ID: 45744 Type: Default 1000ms 256MiB

Second Highest Unique Element

Second Highest Unique Element

You are given a list of integers. Your task is to find the second highest unique element in the list. If there is no such element (i.e. the list has fewer than two distinct numbers), output -1.

For example, in the list [4, 1, 3, 2, 5], the highest number is 5 and the second highest unique element is 4.


Note: The input is provided via standard input and the output should be printed to standard output.

inputFormat

The input consists of two lines. The first line contains an integer n, which represents the number of elements in the list. The second line contains n space-separated integers.

outputFormat

Print the second highest unique element from the list. If no such element exists, print -1.## sample

5
4 1 3 2 5
4