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

ans="No"
if a[0]^a[1]^a[2]==0 and a[-1]^a[0]^a[1]==0 and a[-2]^a[-1]^a[0]==0:
  ans="Yes"

if ans=="Yes":
  for i in range(3,N):
    if a[i]!=a[i-3]:
      ans="No"
      break
      
print(ans)