409783: GYM103741 M XOR Almost Everything
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
M. XOR Almost Everythingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Walk_alone has a sequence $$$a$$$ of length $$$n$$$. He can do the following operations for arbitrary times (possibly zero):
- Select an index $$$x$$$ and an integer $$$y$$$ ($$$1 \leq x \leq n, 0 \leq y < 2^{30}$$$);
- For all index $$$i$$$ such that $$$i \neq x$$$, change $$$a_i$$$ to $$$a_i \oplus y$$$, where $$$\oplus$$$ denotes bitwise XOR.
Note that Walk_alone can select different $$$y$$$ in different operations.
Now he wants to know if he can change all numbers in the sequence to $$$0$$$.
InputThe first line contains a integers $$$n\ (1 \leq n \leq 10^5)$$$, the length of sequence $$$a$$$.
The next line contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n \ (0 \leq a_i < 2^{30})$$$, indicating the elements in $$$a$$$.
OutputPrint "$$$\mathtt{YES}$$$" (without quotes) if Walk_alone can change all numbers in the sequence to $$$0$$$, otherwise print "$$$\mathtt{NO}$$$".
ExamplesInput5 5 4 2 1 2Output
YESInput
5 9 3 5 6 1Output
NO