Problem J: 【GESP3】分糖果

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:28 Solved:14

Description

Input

Output

Sample Input Copy

4
1 4 3 3

Sample Output Copy

16

HINT

 1=<n<=2*10^5 ;   0=<ai<=10^6。