LogiQuest

319. Find the Duplicate Number

MediumXORCycle Detection

The array has n + 1 integers in 1..n, so at least one value repeats. Exactly one value is repeated (possibly several times). Print it.

Input format

Line 1: n + 1 Line 2: the values

Output format

The repeated value.

Example 1

Input

5
1 3 4 2 2

Output

2

Example 2

Input

5
3 1 3 4 2

Output

3

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…