n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if i==0:
    ai=a[i]
    x=a[i+1]^a[n-1]
    if x==ai:
      ans="Yes"
    else:
      ans="No"
      break
  elif i==n-1:
    ai=a[i]
    x=a[0]^a[i-1]
    if x==ai and ans=="Yes":
      ans="Yes"
    else:
      ans="No"
      break
  else:
    ai=a[i]
    x=a[i+1]^a[i-1]
    if x==ai and ans=="Yes":
      ans="Yes"
    else:
      ans="No"
      break
print(ans)