Find the Duplicate Number

MediumArrays
Next
ArrayTwo Pointers

An array of n + 1 integers contains values in the range 1 to n. Exactly one value is repeated (it may appear more than twice). Find it.

Input

Line 1: n + 1, the length of the array. Line 2: the integers.

Output

Print the repeated value.

Constraints

2 <= n + 1 <= 10^5 1 <= each value <= n

Example 1
Input
5
1 3 4 2 2
Output
2

2 appears twice.

Hints

Find the Duplicate Number - Medium Arrays Problem | Skill Shiksha