#C14254. Remove Duplicates and Sort
Remove Duplicates and Sort
Remove Duplicates and Sort
You are given a list of integers. The task is to remove all duplicate elements from the list and output the remaining unique values in ascending order.
Mathematically, if the input list is \(A = [a_1, a_2, \ldots, a_n]\), you must output a sorted list \(B\) such that \(B = \text{sort}(\{a_1, a_2, \ldots, a_n\})\). This means that every element in \(B\) is unique and the list is sorted in non-decreasing order.
It is guaranteed that the input format is as described in the input section. Your program should read from standard input and write to standard output.
inputFormat
The first line of input contains a single integer (n) which represents the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Output the unique elements in the list in ascending order, separated by a single space. If the list is empty, output nothing.## sample
9
4 5 6 4 3 5 2 1 1
1 2 3 4 5 6