
def binary_list(N):
    bin_list = []
    for i in range(36):
        bin_list.append(N % 2)
        N //= 2

    return bin_list

n = int(input())
a = input().split()

flag = True

binary_matrix = [[] for i in range(n)]

if n % 3 != 0:
    flag = False



for i in range(len(a)):
    a[i] = int(a[i])

if flag:
    for i in range(n):
        binary_matrix[i] = binary_list(a[i])

    for j in range(36):
        if flag:
            countof1 = 0
            for i in range(n):
               
                if binary_matrix[i][j] == 1:
                    countof1 +=1
            
            if countof1 != int(n*2/3) and countof1 != 0:
                flag = False
                break 
    
    c = True
    while c:
        countof1 = 0
        index3 = 0
        for j in range(36):
            index3 =0
            for i in range(n):
                if binary_matrix[i][j] == 0:
                    binary_matrix[i], binary_matrix[3*index3] = binary_matrix[3*index3] ,binary_matrix[i]
                    if 3*(index3 +1) < n:
                        index3 += 1
                        

                else:
                    c = False

        
    for j in range(36):
        for i in range(n):
            if binary_matrix[0][j] == 0:
                for index3 in range(int(n/3)):
                    if binary_matrix[3*index3][j] != 0:
                        flag = False
                        break
            elif binary_matrix[1][j] == 0:        
                for index3 in range(int(n/3)):
                    if binary_matrix[3*index3 + 1][j] != 0:
                        flag = False
                        break

            elif binary_matrix[2][j] == 0:        
                for index3 in range(int(n/3)):
                    if binary_matrix[3*index3 + 2][j] != 0:
                        flag = False
                        break

if flag:
    print("Yes")

else:
    print("No")

            
