CF574A Bear and Elections

题目描述

`Limak`前来参加选举。 在选举中,候选人总共有$n$位,第$i$位候选人当前的选票是$a_{i}$。 `Limak`十分渴望权力,于是他决定使用下作的手段赢得选举——贿赂市民。对于每一个市民,`Limak`只需要一颗糖果就可以贿赂他。 请问,`Limak`至少需要几颗糖果才能赢得选举?

输入格式

第一行,一个整数$n$; 第二行,$n$个正整数,表示第$i$位候选人当前的选票$a_{i}$; 输出`Limak`至少需要几颗糖果才能赢得选举;

输出格式

Print the minimum number of citizens Limak must bribe to have strictly more votes than any other candidate.

说明/提示

$2 \leq n \leq 100$; $1 \leq a_{i} \leq 1000$;