#K85782. Equal Sum Partition

    ID: 36718 Type: Default 1000ms 256MiB

Equal Sum Partition

Equal Sum Partition

Given an array of integers, determine whether it is possible to divide the array into two non-empty subsets such that the sums of their elements are equal. In other words, if the total sum of the array is \(S\), check if there exists a proper non-empty subset whose sum is \(\frac{S}{2}\).

Note that the two subsets need not consist of consecutive elements of the array. The input will be provided via stdin and the output must be printed to stdout.

inputFormat

The first line contains an integer \(n\) which represents the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.

outputFormat

Print YES if it is possible to partition the array into two non-empty subsets with equal sum; otherwise, print NO.

## sample
5
1 2 3 4 5
NO