#K9056. Find Special Subset

    ID: 37779 Type: Default 1000ms 256MiB

Find Special Subset

Find Special Subset

You are given a list of integers (which may contain duplicates). Your task is to find a subset of these integers which forms a strictly increasing sequence. Among all such subsets, the one that has maximum length and the minimum possible sum (when ordered in increasing order) is unique and must be returned.

Note: In this problem, the unique answer is simply the sorted set of the given numbers (i.e. removing duplicates and sorting them in ascending order), which always yields a strictly increasing sequence with minimum sum.

Input Format (stdin): The first line contains an integer n, the number of integers. The second line contains n space-separated integers.

Output Format (stdout): Print the resulting subset as space-separated integers in a single line.

Examples:

Input:
8
5 -2 3 8 4 1 10 6
Output:
-2 1 3 4 5 6 8 10

Input: 9 9 8 7 6 5 4 3 2 1 Output: 1 2 3 4 5 6 7 8 9

</p>

inputFormat

The input is read from standard input and consists of two lines. The first line contains an integer n representing the count of numbers. The second line contains n space-separated integers.

outputFormat

The output is a single line of space-separated integers representing the special subset in strictly increasing order with the minimum sum.

## sample
8
5 -2 3 8 4 1 10 6
-2 1 3 4 5 6 8 10