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])
    beaf = bef ^ aft
    #bef = int(format(bef,'b').zfill(32),0)
    #aft = int(format(aft,'b').zfill(32),0)
    #print(format(beaf,'b').zfill(32),format(mylist[i],'b').zfill(32))
    #xor
    if format(beaf,'b').zfill(32) == format(mylist[i],'b').zfill(32):
        #if (bef^aft) == format(mylist[i],'b').zfill(32):
        continue
    else:
        print('No')
        sys.exit()    
  
print('Yes')