Finding Forks
면접 대비시간 제한1초메모리 제한1024 MB
여러 종류의 포크 개수가 주어질 때, 최소 두 칸이 비게 되는 최소 세척 포크 수를 구한다.
문제
Your cutlery drawer contains many types of forks. Each with their own purpose, and each with its own place in the cutlery drawer. After a nice dining party with all your friends, disaster struck! You put all the used forks in the dishwasher, but now you are unsure where to put back some of the forks, because at least two places in the cutlery drawer are empty! And worse, you do not remember which type of fork belongs where!
What is the minimum number of forks that must have been in the dishwasher to cause this confusion?
입력
The input consists of:
- One line with an integer (), the number of types of forks.
- One line with integers (), the number of forks of each type.
출력
Output the minimum number of forks that must have been in the dishwasher.