#C9715. Remove Duplicates and Sort

    ID: 53839 Type: Default 1000ms 256MiB

Remove Duplicates and Sort

Remove Duplicates and Sort

Given an array of integers, your task is to remove any duplicates and output the unique elements in ascending order. In other words, if the sorted array is \(a_1, a_2, \ldots, a_k\), then it must satisfy $$a_i \leq a_{i+1}$$ for every valid index \(i\).

The input starts with an integer \(n\) that represents the number of elements, followed by \(n\) space-separated integers. Your program should output the sorted list of unique integers on a single line, separated by spaces.

inputFormat

The first line contains a single integer \(n\) denoting the number of elements in the array. The second line contains \(n\) space-separated integers.

outputFormat

Output a single line with the sorted sequence of unique integers separated by spaces. If the input array is empty, output nothing.

## sample
7
4 5 9 0 4 2 9
0 2 4 5 9