n,*a=map(int,open(0).read().split())
a*=2
for i in range(n):
    x=bin(a[i])[2:]
    y=bin(a[i+2])[2:]
    if len(x)>len(y):
        y=(len(x)-len(y))*"0"+y
    else:
        x=(len(y)-len(x))*"0"+x
    if a[i+1]!=int("".join(["01"[(x[i]+y[i]).count("1")%2] for i in range(len(x))]),2):
        print("No")
        exit()
print("Yes")
    