#K57187. Unique Numbers Extraction

    ID: 30365 Type: Default 1000ms 256MiB

Unique Numbers Extraction

Unique Numbers Extraction

In this problem, you are given a sequence of integers. Your task is to extract all distinct integers from the given sequence in the order of their first occurrence.

For example, given the list: ( [1, 2, 2, 3, 4, 4, 5] ), the expected output is: ( [1, 2, 3, 4, 5] ).

inputFormat

The input is given via standard input (stdin).

The first line contains an integer ( n ) which represents the number of elements in the sequence. The second line contains ( n ) space-separated integers.

outputFormat

Output the distinct numbers, maintaining the order of their first appearance. The numbers should be printed on a single line separated by a single space to standard output (stdout).## sample

7
1 2 2 3 4 4 5
1 2 3 4 5