n = int(input()) n2 = 1< now^b: if A[b] != A[now]^A[now^b]: print("No") exit() now = (now-1) & b print("Yes")