N=int(input())
a=list(map(int, input().split()))
Flag=True

#print(bin(a[N-1] ^ a[1]))
#print(bin(a[0]))

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    for i in range(0,N-3):
      #print(bin(a[N] ^ a[N+2]),bin(a[N+1]))
      if Flag:
        if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
          Flag=False
          break  
    if Flag:
      print("Yes")
    else:
      print("No")
  else:
    print("No")    
else:
  print("No")
    