#K37957. Second Largest Unique Integer

    ID: 26091 Type: Default 1000ms 256MiB

Second Largest Unique Integer

Second Largest Unique Integer

Given a list of integers, your task is to find the second largest unique integer. If such an integer does not exist (i.e. if there is only one unique value), print (-1).

The input is provided via standard input, and the output should be written to standard output. Your solution should handle negative numbers as well.

Example: For the list [2, 3, 6, 6, 5], the largest unique integer is 6 and the second largest unique integer is 5, so the output should be 5.

inputFormat

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

Output a single integer: the second largest unique integer from the list, or (-1) if no such integer exists.## sample

5
2 3 6 6 5
5