n = int(input())
x = list(map(int, input().split()))
sum = 1

sum = sum * (x.count(x[n-1] ^ x[1])>0)
for i in range(1, (n-1 - 1 )):
    sum = sum * (x.count(x[i-1] ^ x[i+1])>0)
sum = sum * (x.count(x[n-2] ^ x[0])>0)

if sum == 1:
    print("Yes")
else:
    print("No")
