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

for i in range(1,n-1):
    if bin(x[i-1]^x[i+1])!=bin(x[i]):
        print("No")
        break
    elif bin(x[n-2]^x[0]) == bin(x[n-1]):
        print("Yes")