#d11401. 放置多米诺骨牌

放置多米诺骨牌

Placing Dominoes

Problem Description

You are given a histogram-like figure with nn columns whose heights are a1,a2,…,ana_1, a_2, \dots, a_n (a1≥a2≥a3⋯≥ana_1 \ge a_2 \ge a_3 \dots \ge a_n). You have many 1×21 \times 2 dominoes (which may be rotated). What is the maximum number of dominoes you can place without overlap?

Input Format

The first line contains an integer nn.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

Output one number: the answer.

Sample Input

5
3 2 2 2 1

Sample Output

4

Constraints

All data guarantee 1≤n≤3000001 \le n \le 300000, 1≤ai≤3000001 \le a_i \le 300000.