#C12468. Find Duplicate Integers

    ID: 41898 Type: Default 1000ms 256MiB

Find Duplicate Integers

Find Duplicate Integers

Given a list of integers, identify all the integers that appear more than once and output them in sorted order. Each duplicate integer should be printed only once.

If there are no duplicate integers in the list, output -1.

For example, if the input list is [4, 3, 2, 7, 8, 2, 3, 1], the duplicate integers are 2 and 3, so the expected output is:

2 3

inputFormat

The first line of input contains an integer (n) representing the number of integers in the list. The second line contains (n) space-separated integers.

outputFormat

Output the duplicate integers in sorted order, separated by a single space. If there are no duplicates, output -1.## sample

5
10 5 3 8 6
-1

</p>