PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000054. Chia đều hành lý (Luggage)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Chia đều hành lý (Luggage)

Luggage

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn suitcases with positive integer weights a1,…,ana_1,\ldots,a_n. Every suitcase must be loaded intact into exactly one of two cars; no suitcase may be split or left behind. Determine whether the suitcases can be partitioned into two groups of equal total weight. Output only whether such a partition exists.

Input

The first line contains nn. The second line contains nn positive integers aia_i.

Output

Print YES if an equal partition exists, otherwise print NO (uppercase).

Subtasks

Scoring groups are independent. All constraints listed for a group apply simultaneously.

  • Subtask 1 (20%): 1≤n≤81\le n\le8, 1≤ai1\le a_i and ∑ai≤40\sum a_i\le40.
  • Subtask 2 (30%): 1≤n≤151\le n\le15, 1≤ai1\le a_i and ∑ai≤120\sum a_i\le120.
  • Subtask 3 (50%): 1≤n≤201\le n\le20, 1≤ai1\le a_i and ∑ai≤200\sum a_i\le200.

Examples

Input

4
1 5 11 5

Output

YES

Explanation

The total weight is 2222. One car takes the 1111-kg suitcase; the other takes 1+5+5=111+5+5=11 kg, so both carry 1111 kg.