#AGC003B. [AGC003B] Simplified mahjong

[AGC003B] Simplified mahjong

Score : 400400 points

Problem Statement

Snuke has a large collection of cards. Each card has an integer between 11 and NN, inclusive, written on it. He has AiA_i cards with an integer ii.

Two cards can form a pair if the absolute value of the difference of the integers written on them is at most 11.

Snuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create.

Constraints

  • 1N1051 \leq N \leq 10^5
  • 0Ai109(1iN)0 \leq A_i \leq 10^9 (1 \leq i \leq N)
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1

:

ANA_N

Output

Print the maximum number of pairs that Snuke can create.

4
4
0
3
2
4

For example, Snuke can create the following four pairs: (1,1),(1,1),(3,4),(3,4)(1,1),(1,1),(3,4),(3,4).

8
2
0
1
6
0
8
2
1
9