| SDU Open 2023 |
|---|
| Finished |
Batyr and Mazen decided to go to a popular place where they cook wok and offer $$$n$$$ different toppings. Each topping changes the taste of the wok by $$$a_i$$$, which can also be a negative number. Wok without any toppings has a taste of $$$0$$$.
They want to try all possible woks, which is a total of $$$2^n$$$. Batyr wants to write down a list of the order in which they will try all the woks. Then he will share this list with Mazen. However, since Mazen's native language is Arabic, he will read this list from right to left. This means that the first wok in Batyr's list will be the last in Mazen's list and vice versa.
To avoid disagreements or conflicts, Batyr wants to create the list in such a way that the woks they will try at the same time always have the same taste for both him and Mazen. In other words, Batyr needs to ensure that the tastes of the woks are identical when reading the list from left to right and from right to left.
Determine if Batyr can create such a list.
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 30$$$) - the number of toppings.
The second line contains $$$n$$$ integers $$$a_1, \ldots, a_n$$$ ($$$-10^9 \leq a_i \leq 10^9$$$) - the tastes of the toppings.
If it is possible to create a list, print 'YES'. Otherwise, print 'NO'.
2 1 -2
NO
3 -1 0 1
YES
In the first example, there are only $$$4$$$ possible woks:
It can be shown that there is no order in which the tastes of the woks would be identical when reading the list from left to right and from right to left.
| Name |
|---|


