#P354. 【例61.2】 最近的一对

【例61.2】 最近的一对

Description

Given an array aa containing nn elements, find the pair of indices ii and jj in aa that are closest to each other, satisfying i<ji < j and a[i]=a[j]a[i] = a[j]. If multiple pairs exist, output the value of a[i]a[i] corresponding to the smallest ii. For example, in the array of 1010 numbers 19,13,11,19,11,5,6,3,4,319, 13, 11, 19, 11, 5, 6, 3, 4, 3, the numbers that satisfy a[i]=a[j]a[i] = a[j] include 19,11,319, 11, 3. Among these, the pairs 1111 and 33 are closer in distance, and in the case of equal distances, 1111 has a smaller index. If no identical numbers exist, output "No".

Input Format

The first line contains a single integer nn representing the length of the array (2n1000002 \le n \le 100000).
The next nn lines each contain a single integer, representing the elements of the array (1a[i]1091 \le a[i] \le 10^9).

Output Format

Output the value of a[i]a[i] corresponding to the smallest ii that meets the conditions.

Sample

10
19
13
11
19
11
5
6
3
4
3
11