Submit solution

Points:
7 (partial)

Time limit:
0.6s

Memory limit:
1G

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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.

#### Constraints

In tests worth 5 marks, the sum of all will be less than or equal to .

#### Input Specification

The first line contains a single integer, .

Each of the next lines contains a single integer, through in order.

#### Output Specification

Print, on a single line, the maximum number of modifications that can be performed.

#### Sample Input

```
3
1
2
1
```

#### Sample Output

`2`

#### Sample Input

```
5
1
2
1
10
3
```

#### Sample Output

`7`

## Comments