#K44547. Equal Sum Subset Partition

    ID: 27555 Type: Default 1000ms 256MiB

Equal Sum Subset Partition

Equal Sum Subset Partition

You are given a list of integers. Your task is to determine whether it can be partitioned into two subsets such that the sum of the elements in both subsets is equal. In mathematical terms, let \( S \) be the total sum of the array. A necessary condition for the partition to exist is that \( S \) is even. If \( S \) is even, then there exists a subset whose sum equals \( \frac{S}{2} \).

You should output YES if such a partition exists and NO otherwise.

Example:

Input:
4
1 5 11 5

Output: YES

</p>

inputFormat

The first line of input contains an integer N, representing the number of elements in the list.

The second line contains N space-separated integers.

outputFormat

Output a single line with the word YES if the list can be partitioned into two subsets with equal sum, or NO if it cannot.

## sample
4
1 5 11 5
YES