#K54842. Second Largest Unique Integer
Second Largest Unique Integer
Second Largest Unique Integer
You are given a list of n integers. Your task is to determine the second largest unique integer in the list. In other words, if the list contains duplicate elements, only consider distinct values. If there exists at least two different integers, output the second largest one; otherwise, output -1.
Mathematically, let \( A \) be the set of unique integers extracted from the input list. If \(|A| \ge 2\), sort \( A \) in descending order \( (a_1 \ge a_2 \ge \cdots) \) and output \( a_2 \). If \(|A| < 2\), then output -1.
inputFormat
The first line of input contains a single integer n representing the number of integers in the list. The second line contains n space-separated integers.
outputFormat
Output a single integer which is the second largest unique integer in the list. If there is no such integer, output -1.
## sample5
4 2 5 2 3
4
</p>