N = int(input())
nums = list(map(int, input().split()))
counts = 0

for i in range(len(nums)):
  if i == 0:
    counts += bin(nums[0]) == bin(nums[-1] ^ nums[1])
  elif i == len(nums) - 1:
    counts += bin(nums[len(nums) - 1]) == bin(nums[len(nums) - 2] ^ nums[0])
  else:
    counts += bin(nums[i]) == bin(nums[i - 1] ^ nums[i + 1])
  
if counts == len(nums):
  print("Yes")
else:
  print("No")