Osman and His Array

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem types

Osman has an array \(a_1\), \(a_2\),...,\(a_n\).

In one operation, Osman chooses two different indices in the array \(p\) and \(q\) and decrease the integers \(a_p\) and \(a_q\) by one.

Osman wonders whether it is possible to make all the elements in the array zero or not. Can you help Osman find out?

Input

The first line contains the number \(N\), the size of the array.

The second line contains \(N\) integers, \(a_1\), \(a_2\),...,\(a_n\), the elements of the array.

  • \(2 \leq N \leq 10^5\)
  • \(1 \leq a_i \leq 10^9\)

Output

If it is possible to make all the elements 0, you should print "YES". If it is not, you should print "NO".

Examples

Input 1:

4
4 4 7 7

Output 1:

YES

Input 2:

6
1 2 3 4 5 6

Output 2:

NO

Explanations

  • In the first input, it is possible to make all the elements 0, by choosing the first 2 elements in 4 steps and choosing the last 2 elements in 7 steps, decreasing them by 1 each time.
  • It is impossible to make them 0 in the second input.