#agc035a. [agc035_a]XOR Circle
[agc035_a]XOR Circle
Problem Statement
Snuke has hats. The -th hat has an integer written on it.
There are 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? The bitwise XOR of non-negative integers is defined as follows: - When is written in base two, the digit in the 's place () is if the number of integers among whose binary representations have in the 's place is odd, and if that count is even. For example, .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
1 2 3
Sample Output 1
Yes
- If we put the hats with , , and in this order, clockwise, the condition will be satisfied for every camel, so the answer is
Yes
.
Sample Input 2
4
1 2 4 8
Sample Output 2
No
- There is no such way to distribute the hats; the answer is
No
.