LogiQuest

430. Find All Duplicates

MediumArray

Values are in [1, n] and each appears once or twice. Print the values that appear twice, in increasing order, or NONE. Try O(1) extra space.

Input format

Line 1: n Line 2: n integers

Output format

The duplicates or NONE.

Example 1

Input

8
4 3 2 7 8 2 3 1

Output

2 3

Example 2

Input

3
1 1 2

Output

1

Constraints

1 ≤ n ≤ 10⁵

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

Loading the MyLoginn IDE…