import collections

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 not_used_hat_set:
        if(distance_map[index-1][j] == index+1):
            current_hat_list[index] = j + 1
            if(index == N - 1):
                return True
            else:
                step(index + 1, not_used_hat_set - set([j + 1]), 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]
distance_map = collections.Counter()
for n in range(N):
    tmp = [distance(bynary_list[n], bynary_list[m]) for m in range(N)]
    distance_map[n+1] = tmp

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+1)%N
    hat[1] = (n+2)%N
    not_used_hat_set = not_used_hat_set - set([n, (n+1)%N])
    ans = step(2, not_used_hat_set, hat)
    if(ans == True):
        break
if(ans == True):
    print("Yes")
else:
    print("No")