시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB31201672.727%

문제

You have a chocolate bar consisting of $N$ chunks (numbered from $1$ to $N$). Chunk $i$ contains $A_i$ peanut bits. You can divide the chocolate bar into several pieces, with each piece consisting of one or more consecutive chunks. Each chunk can only be part of one piece. The total number of peanut bits in a piece is simply the sum of the peanut bits from each of its chunks.

A piece is considered a double chunk if and only if it consists of exactly two chunks. You are required to divide the chocolate bar into as many double chunks as possible, all having the same total number of peanut bits. Determine the maximum number of double chunks you can get while satisfying this requirement.

입력

The first line consists of an integer $N$ ($2 ≤ N ≤ 100\, 000$).

The second line consists of $N$ integers $A_i$ ($1 ≤ A_i ≤ 10^9$).

출력

Output a single integer representing the maximum number of double chunks you can get while satisfying the requirement.

예제 입력 1

10
2 4 1 4 5 2 3 1 1 4

예제 출력 1

3

You can make $3$ double chunks, each containing $5$ peanut bits. The first piece consists of chunks $2$ and $3$, which have $4$ bits and $1$ bit, respectively. The second piece consists of chunks $6$ and $7$, which have $2$ bits and $3$ bits, respectively. The third piece consists of chunks $9$ and $10$, which have $1$ bit and $4$ bits, respectively.

예제 입력 2

7
1 2 1 1 1 2 1

예제 출력 2

2

예제 입력 3

5
1 2 3 4 5

예제 출력 3

1