#C14580. Find Duplicate Integers

    ID: 44245 Type: Default 1000ms 256MiB

Find Duplicate Integers

Find Duplicate Integers

You are given a list of integers. Your task is to identify all duplicate integers and output each duplicate exactly once in the order in which it first appears as a duplicate.

More formally, if the input list is \(a_1, a_2, \dots, a_n\), you need to find all integers \(x\) such that \(x\) appears at least twice. In the output, each such integer \(x\) should appear only once and in the order when a duplicate of \(x\) is encountered for the first time.

Input/Output

The program should read from stdin and write the result to stdout as described below.

inputFormat

The first line contains a single integer \(N\) indicating the number of elements in the list.

The second line contains \(N\) space-separated integers representing the list elements.

outputFormat

Output the duplicate integers in the order they first appear, separated by a single space. If there are no duplicates, output nothing.

## sample
9
1 2 3 2 4 5 1 6 3
2 1 3