import Data.Bool
import Data.List

main :: IO ()
main = do
    n <- readLn
    xs <- sort.map read.words <$> getLine
    putStrLn.bool"No""Yes" $ solve n xs

solve :: Int -> [Int] -> Bool
solve 0 [_] = True
solve n xs = and (zipWith (<) ys zs) && solve (n - 1) zs
   where
     (ys, zs) = splitAt (2^(n - 1)) xs