local N = io.read("n")
local S = {}
--local set = {}
for i=1,2^N do
    local s = io.read("n")
    S[i] = s
    --set[s] = true
end
table.sort(S, function(x,y)return x>y end)
local count = #S
for n=1,N do
    local half = count // 2
    for i=1,half do
        if S[i] > S[half+i] then
            -- OK
        else
            print("No")
            return
        end
    end
    count = half
end
print("Yes")