n =int(input())
rakuda = [0] * n

rakuda = []
s = input()
rakuda = s.split(' ')
# print(rakuda)

# for i in range(n):
#     # print(i)
#     rakuda[i] = int(input())

flag = True
for i in range(n):
    left = i - 1;
    right = i + 1;
    if(left == -1): left = n - 1
    if(right == n): right = 0
    
    if((int(rakuda[left]) ^ int(rakuda[right])) != int(rakuda[i])):
        flag = False
        break


if(flag == False):
    print("No")
else:
    print("Yes")
