#P339. 【例58.2】 序列处理

【例58.2】 序列处理

Description

Given a sequence of nn integers, output their sum, maximum value, minimum value, and the sequence sorted in descending order (with duplicates removed).

Input Format

The first line contains an integer nn (1<n1041 < n ≤10^4).
The second line contains nn integers aia_i (1ai1041 ≤a_i ≤10^4).

Output Format

The first line outputs an integer representing the sum.
The second line outputs an integer representing the maximum value.
The third line outputs an integer representing the minimum value.
The fourth line outputs a sequence of integers separated by spaces, representing the sequence sorted in descending order (with duplicates removed).

Sample

8
8 5 1 9 2 6 2 6
39
9
1
9 8 6 5 2 1