_ = input()
input_num = [int(i) for i in input().split(" ")]

input_size = len(input_num)-1
for i in range(len(input_num)-1):
    left = i-1
    right = i+1
    if left < 0:
        left = input_size
    if right < input_size:
      right = 0
#     print(input_num[left])
#     print(input_num[right])
    if input_num[left]^input_num[right] == input_num[i]:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
