Card Pairs
시간 제한1초메모리 제한1024 MB
같은 종류의 카드 두 장을 다른 종류의 카드 한 장으로 바꾸는 거래를 반복할 때, 주어진 초기 카드 수에서 가능한 최대 거래 횟수를 구한다.
문제
You have a hand of cards, where each card has one of types. For each from to , you have cards with type , and the bank has infinite cards with type .
You can perform the following trade with the bank any number of times:
Choose any two cards with the same type from your hand, and exchange them for a single card from the bank with any type except the type of the cards you just exchanged. Note that the bank only has cards with types through , so you cannot trade for cards with any other types.
For example, here is a valid sequence of trades on the first sample case:

What is the maximum number of trades you can perform?
입력
The first line of the input contains a single integer () --- the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () --- the number of card types.
The second line of each test case contains integers (), where is the number of cards of type that you currently have.
It is guaranteed that the sum of over all test cases does not exceed .
출력
For each test case, print a single integer --- the maximum number of trades you can perform.
힌트
The diagram above describes an optimal sequence of trades in the first test case.
In the fourth test case, it is impossible to perform any trades, since you don't start with any pair of cards with the same type, so the answer is .