x = input().split(" ")
x = [int(s) for s in x]
if(x[0] < 3 | x[0] > 10000 | len(x) < 1 | len(x) > 10^9 + 1):
    print("No")
else:
    for i in range(2,len(x)-1):
        if x[i] != x[i-1] ^ x[i+1]:
            print("No")
            break
    print("YES")  