n = int(input())
A = list(map(int,input().split()))
flag = True
for i in range(n):
  if i==0 and bin(A[-1]^A[1])!=bin(A[0]):
    flag = False
    break

  if i==n-1:
    if bin(A[0]^A[i-1])!=bin(A[i]):
      flag = False
      break
    else:
      break
  
  if not bin(A[i-1]^A[i+1])==bin(A[i]):
    flag = False
    break

print('Yes' if flag else 'No')