#AGC035A. [AGC035A] XOR Circle

[AGC035A] XOR Circle

Score : 300300 points

Problem Statement

Snuke has NN hats. The ii-th hat has an integer aia_i written on it.

There are NN camels standing in a circle. Snuke will put one of his hats on each of these camels.

If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.

  • The bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.
What is XOR? $$x_1 \oplus x_2 \oplus \ldots \oplus x_n$$$$n$$$$x_1, x_2, \ldots, x_n$$$$x_1 \oplus x_2 \oplus \ldots \oplus x_n$$$$2^k$$$$k \geq 0$$$$1$$$$x_1, x_2, \ldots, x_n$$$$1$$$$2^k$$$$0$$$$3 \oplus 5 = 6 $$

Constraints

  • All values in input are integers.
  • 3N1053 \leq N \leq 10^{5}
  • 0ai1090 \leq a_i \leq 10^{9}

Input

Input is given from Standard Input in the following format:

NN

a1a_1 a2a_2 \ldots aNa_{N}

Output

Print the answer.

3
1 2 3
Yes
  • If we put the hats with 11, 22, and 33 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.
4
1 2 4 8
No
  • There is no such way to distribute the hats; the answer is No.