Equal Cargo Split

Medium

1s time · 256MB memory · arrays, prefix sums

A cargo train must be split at one wagon for weighing: everything strictly before the chosen wagon goes on the left scale, everything strictly after it on the right scale (the chosen wagon itself is on neither).

Determine whether there exists a wagon such that the sum of all values before it equals the sum of all values after it.

Input

The first line contains one integer n — the number of wagons.

The second line contains n integers a₁ … aₙ.

Output

Print YES if such a wagon exists, otherwise NO.

Constraints

  • 1 ≤ n ≤ 2·10⁴
  • −10⁷ ≤ aᵢ ≤ 10⁷
  • An empty side sums to 0 (so for n = 1 the answer is always YES).

Samples

Input 1
6
1 7 3 6 5 6
Output 1
YES
Input 2
3
1 2 3
Output 2
NO
Sign in (top right) to run or submit.