#C2221. Sort and Remove Duplicates
Sort and Remove Duplicates
Sort and Remove Duplicates
Given a list of integers, remove any duplicate values and output the sorted unique integers in ascending order. The first input line contains an integer n representing the number of elements in the list. The second line contains n space-separated integers. If the list is empty (n = 0), then no output should be produced.
The task is to compute the unique elements and then sort them. The result should be printed on a single line with each number separated by a space.
Mathematically, if the input list is \(L = [a_1, a_2, \dots, a_n]\), then the result is \(\text{sorted}(\{a_1, a_2, \dots, a_n\})\).
inputFormat
The first line of the input consists of an integer n which indicates the number of integers. The second line contains n space-separated integers.
outputFormat
Output a single line containing the sorted unique integers separated by a space. If the list is empty, output nothing.
## sample6
3 1 2 3 4 2
1 2 3 4