#C656. Unique Sorted List and Sum

    ID: 50333 Type: Default 1000ms 256MiB

Unique Sorted List and Sum

Unique Sorted List and Sum

You are given a list of integers. Your task is to compute a sorted list of the unique integers from the input, and then compute the sum of these unique integers.

More formally, given an input list \(L = [a_1, a_2, \dots, a_n]\), let \(S = \{a_i : 1 \leq i \leq n\}\) be the set of unique integers in \(L\). The goal is to output the sorted list of elements in \(S\) and the sum \(\sum_{x \in S} x\).

The program should read the input from standard input and write the output to standard output.

inputFormat

The first line consists of an integer \(n\), the number of elements in the list. The second line contains \(n\) space-separated integers.

outputFormat

Output two lines. The first line contains the unique integers in sorted order (ascending) separated by spaces. The second line contains the sum of these unique integers.

## sample
6
4 2 9 4 2 5
2 4 5 9

20

</p>