keta_max = 30
def decimal_to_binary(number):
    ans = ""
    for i in range(keta_max):
        ans += str(number // 2**(keta_max - 1 - i))
        number = number % 2**(keta_max - 1 - i)
    return ans

def distance(left, right):
    ans = 0
    for i in range(keta_max):
        if(abs(int(left[i]) - int(right[i]))):
            ans += 2**(keta_max - 1 - i)
    return ans

def step(index, not_used_hat_set, current_hat_list):
    for j in range(N):
        if(distance(bynary_list[current_hat_list[index-1]], bynary_list[j])):
            current_hat_list[index] = j
            if(index == N - 1):
                return True
            else:
                step(index + 1, not_used_hat_set - set([j]), current_hat_list)
    return False

N = int(input())
a_list = list(map(int, input().split()))

bynary_list = [decimal_to_binary(i) for i in a_list]
for n in range(N):
    hat = [0 for m in range(N)]
    not_used_hat_set = set([m for m in range(N)])
    hat[0] = n
    hat[1] = (n+1)%N
    ans = step(2, not_used_hat_set, hat)
if(ans == True):
    print("Yes")
else:
    print("No")