#C14420. Unique Sorted List

    ID: 44068 Type: Default 1000ms 256MiB

Unique Sorted List

Unique Sorted List

Given a list of integers, your task is to remove all duplicate elements and then sort the remaining unique numbers in ascending order. Formally, for a given list ( A = [a_1, a_2, \dots, a_N] ), you are required to construct a new list ( B ) such that every element in ( B ) appears in ( A ) at least once, no two elements in ( B ) are the same, and ( B ) is sorted in increasing order.

For example, if ( A = [4, 5, 6, 3, 4, 5, 2, 1, 6] ), then the output should be ( B = [1, 2, 3, 4, 5, 6] ).

inputFormat

The input is given via standard input (stdin). The first line contains a single integer ( N ) which denotes the number of elements in the list. The second line contains ( N ) space-separated integers.

outputFormat

Print the unique elements sorted in ascending order in one line, separated by a single space.## sample

9
4 5 6 3 4 5 2 1 6
1 2 3 4 5 6