#C8777. Good Sequence Partition

    ID: 52796 Type: Default 1000ms 256MiB

Good Sequence Partition

Good Sequence Partition

Given a sequence of integers, determine whether it is possible to partition the sequence into two non-empty subsequences such that the sum of the elements in the first subsequence is equal to the sum in the second subsequence.

Formally, let the sequence be \(a_1, a_2, \ldots, a_n\) with total sum \(S = \sum_{i=1}^{n} a_i\). We want to know if there exists a non-empty proper subset \(A \subset \{1,2,\dots,n\}\) such that

\(\sum_{i \in A} a_i = \sum_{i \notin A} a_i\)

The input will be read from standard input (stdin) and the result (either YES or NO) should be printed to standard output (stdout).

inputFormat

The first line of input contains a single integer \(n\) (\(n \geq 2\)), the number of elements in the sequence.

The second line contains \(n\) space-separated integers representing the sequence.

outputFormat

Output YES if the sequence can be partitioned into two non-empty subsequences with equal sums. Otherwise, output NO.

## sample
4
1 2 3 6
YES

</p>