def exc_or(int1, int2):
  exc_or = bin(int1^int2)
  return int(exc_or, 2)

def is_same(start_index_excor, alist, exc_ors):
  for i in range(0, N):
    if alist[i] != exc_ors[start_index_excor+i]:
      return False
  return True

def is_same_reverse(start_index_excor, alist, exc_ors):
  for i in range(0, N):
    if alist[i] != exc_ors[start_index_excor-i]:
      return False
  return True

N = int(input())
alist = list(map(int, input().split()))

exc_ors = []
for i in range(N-1, -1, -1):
  exc_ors.append(exc_or(alist[i-1], alist[i]))

start_index_excors = [index for index, exc_or in enumerate(exc_ors) if exc_or == alist[0]]
if len(start_index_excors) == 0:
  print("No")
  exit()
else:
  for start_index_excor in start_index_excors:
    if is_same(start_index_excor, alist, exc_ors) is True or is_same_reverse(start_index_excor, alist, exc_ors) is True:
      print("Yes")
      exit()
    else:
      pass
  print("No")
      