Points: 7 (partial)
Time limit: 0.6s
Memory limit: 1G
You are given an array of integers. A modification consists of selecting two distinct indices in the array that point to positive integers in the array and decreasing both integers by 1.
Compute the maximum number of modifications you can perform on the array until you can no longer perform any modifications.
In tests worth 5 marks, the sum of all will be less than or equal to .
The first line contains a single integer, .
Each of the next lines contains a single integer, through in order.
Print, on a single line, the maximum number of modifications that can be performed.
Sample Input 1
3 1 2 1
Sample Output 1
Sample Input 2
5 1 2 1 10 3
Sample Output 2