n = int(input())
n_ls = [int(a) for a in input().split(" ")]
result = 'Yes'
max_len = len(n_ls)
for i in range(0, max_len):
  if i == 0:
    if n_ls[i] != (n_ls[max_len - 1] ^ n_ls[i+1]):
      result = 'No'
      break
  elif i == max_len - 1:
    if n_ls[i] != (n_ls[i-1] ^ n_ls[0]):
      result = 'No'
      break     
  elif n_ls[i] != (n_ls[i-1] ^ n_ls[i+1]):
    result = 'No'
    break

print(result)