1908: 狼人杀(werewolf)-2025-小学组-正赛

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

Description

Input

第一行一个整数 n,表示总人数;
第二行 n 个整数 a1, a2, . . . , an,表示每个人希望参与的狼人杀局数。

Output

一个整数,表示至少需要进行的狼人杀局数。

Sample Input Copy

3
2 3 2

Sample Output Copy

4

HINT

对于 50% 的数据,保证 n ≤ 20;
对于所有数据,保证 3 ≤ n ≤ 105,1 ≤ ai ≤ 109