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]
    #xor
    if (bef^aft) == mylist[i]:
        continue
    else:
        print('No')
        sys.exit()    
  
print('Yes')