local N = io.read("n")
local S = {}
for i=1,2^N do
    local s = io.read("n")
    S[i] = s
end
table.sort(S, function(x,y)return x>y end)
local family = {}
family[1] = S[1]
S[1] = -1
for n=1,N do
    local parents = {table.unpack(family)}
    table.sort(parents, function(x,y)return x>y end)
    local todo = 1
    local sidx = 1
    while todo <= #parents and sidx <= #S do
        if S[sidx] ~= -1 and S[sidx] < parents[todo] then
            family[#family + 1] = S[sidx]
            todo = todo + 1
            S[sidx] = -1
        end
        sidx = sidx + 1
    end
    if todo <= #parents then
        print("No")
        return
    end
end
print("Yes")