_ = input()
input_num = [int(i) for i in input().split(" ")]
input_num = [i for i in reversed(input_num)]
input_size = len(input_num)-1

if input_size < 2:
  print("No")
for i in range(len(input_num)):
    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")
