AmazonOA #210
Get Maximum Throughput
估计中等可在线判题
Each group has three servers, and a group's throughput is the median of the three. Each server joins at most one group, and some servers may go unused. Find the maximum total throughput over all groups.
输入格式
The first line contains n; the second line contains the throughputs. 1≤n≤200000, 1≤throughput≤10^9.
输出格式
Output a single integer, the answer.
样例 1
输入:
6
4 6 3 5 4 5
输出:
9
样例 2
输入:
5
2 3 4 3 4
输出:
4
样例 3
输入:
2
9 1
输出:
0
样例说明
The answers are 9, 4 and 0. With fewer than three servers no group can be formed.