Card Pairs
Time limit1sMemory limit1024 MB
Given counts of n card types, find the maximum number of trades where two cards of one type are swapped for one card of a different type.
Problem
You have a hand of cards, and each card has one of types. For each from to , you have cards of type , and the bank has an unlimited supply of cards of every type.
You can trade with the bank any number of times. In each trade, choose two cards of the same type from your hand and exchange them for one card from the bank. The new card may have any type from to except the type of the two cards you gave up. The bank has no cards of other types, so you cannot receive them.
The image below shows a valid sequence of trades on the first sample case.

What is the maximum number of trades you can perform?
Input
The first line contains a single integer (), the number of test cases. Each test case starts with a line containing (), the number of card types. The next line contains integers (), where is the number of cards of type you currently have. The sum of over all test cases does not exceed .
Output
For each test case, print the maximum number of trades you can perform on its own line.
Hint
The image above shows an optimal sequence of trades in the first test case.
In the fourth test case, you have no pair of cards with the same type, so no trade is possible and the answer is .