#C14454. Unique Elements in a List

    ID: 44105 Type: Default 1000ms 256MiB

Unique Elements in a List

Unique Elements in a List

You are given a list of integers. Your task is to output the elements that occur exactly once in the list, preserving their original order. Formally, given a list \(L = [a_1, a_2, \dots, a_n]\), output all elements \(a_k\) such that the frequency of \(a_k\) in \(L\) is \(1\). If no element satisfies this property, output nothing.

For example, if the list is [1, 2, 2, 3, 4, 4, 5], the unique elements are [1, 3, 5].

The input is read from stdin and the output should be written to stdout in a single line separated by spaces.

inputFormat

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

outputFormat

Output a single line containing all unique elements (elements that occur exactly once in the list) in the order of their appearance separated by a single space. If there are no unique elements, output an empty line.

## sample
7
1 2 2 3 4 4 5
1 3 5