#K68617. Find Integers with Odd Occurrences

    ID: 32905 Type: Default 1000ms 256MiB

Find Integers with Odd Occurrences

Find Integers with Odd Occurrences

You are given a list of integers. Your task is to identify and output the integers that appear an odd number of times in the list. The output should preserve the order of the first occurrence of each integer that qualifies.

Formally, given an array (A) of integers, find all integers (a) such that the frequency (f(a)) satisfies (f(a) \equiv 1 \pmod{2}).

inputFormat

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

outputFormat

Output the integers that appear an odd number of times in the array, preserving their first occurrence order. The integers must be separated by a single space. If no integer qualifies, output nothing.## sample

8
1 2 3 2 3 4 4 4
1 4

</p>