import sys

N = int(input())

mylist = list(map(int, input().split()))


for i in range(N):
    
    if i == 0:
        bef = mylist[-1]
        aft = mylist[i+1]
    elif i == (N-1):
        bef = mylist[i-1]
        aft = mylist[0]
    else:
        bef = mylist[i-1]
        aft = mylist[i+1]
        
    #print(bef^aft, mylist[i])
    #xor
    if format((bef^aft),'b').zfill(32) == format(mylist[i],'b').zfill(32): 
        #if (bef^aft) == format(mylist[i],'b').zfill(32):
        continue
    else:
        print(i, 'No')
        sys.exit()    
  
print('Yes')