
N = int(input())

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

def xor(x1,x2):
    xdigit = math.ceil(math.log2(max(x1+1, x2+1)))
    num = 0
    
    #print(x1, x2)
    
    for i in range(xdigit):
        num_digit = 2**(xdigit-i-1)
        dig_x1 = x1 // num_digit
        dig_x2 = x2 // num_digit
        
        #print("x", dig_x1, dig_x2)
        
        if dig_x1 != dig_x2:
            num += num_digit
            
        if dig_x1 == 1:
            x1 -= num_digit
            
        if dig_x2 == 1:
            x2 -= num_digit
    return num

is_exist = True

for camel in range(N):
    if camel == N-1:
        furt = 0
    else:
        furt = camel + 1
        
    if camel == 0:
        prev = N-1
    else:
        prev = camel -1
         
    num_xor = xor(nums[prev], nums[furt])
    
    #print(num_xor)
    
    #print(camel, num_xor, nums[camel])
    
    if num_xor != nums[camel]:
        is_exist = False
        break


if is_exist == True:
    print("Yes")
else:
    print("No")