#C12330. List Duplicates

    ID: 41746 Type: Default 1000ms 256MiB

List Duplicates

List Duplicates

Given an array of integers, your task is to find all duplicate elements and print them in ascending order. Each duplicate should appear only once in the output.

For example, if the input array is \( [4, 3, 2, 7, 8, 2, 3, 1] \), the correct output is \( [2, 3] \).

The input is read from standard input (stdin) and the output is printed to standard output (stdout).

inputFormat

The first line contains an integer ( N ) representing the number of elements. The second line contains ( N ) space-separated integers.

outputFormat

Print the duplicate numbers in ascending order, separated by spaces. If there are no duplicates, print an empty line.## sample

5
1 2 3 4 5