n = int(input())

cap_list = list(map(int, input().split()))

a = True

for i in range(n):
  if i == 0:
    next_result = cap_list[1] ^ cap_list[n-1]
    if cap_list[0] != next_result:
      a = False
      break
  elif i == n-1:
    next_result = cap_list[n-2] ^ cap_list[0]
    if cap_list[i] != next_result:
      a = False
      break
  else:
    next_result = cap_list[i-1] ^ cap_list[i+1]
    if cap_list[i] != next_result:
      a = False
      break

if a:
  print('Yes')
else:
  print('No')