N=int(input())
Left=list(map(int,input().split()))
Right=Left[2:]
Right.append(Left[0])
Right.append(Left[1])
Center=Left[1:]
Center.append(Left[0])

ans='No'


for i in range(N):
  if Left[i]^Right[i]==Center[i]:
    continue
  else:
    break
else:
  ans='Yes'
  
print(ans)