let () = Scanf.scanf "%d\n" @@ fun n ->
  let ss =
    Array.init (1 lsl n) @@ fun _ ->
      Scanf.scanf "%d " @@ fun s -> s in
  Array.sort (fun s s' -> compare s' s) ss;
  let rec solve = function
    | 1 -> true
    | n ->
        let m = n lsr 1 in
        ( && ) (solve m) @@
        Array.fold_left ( && ) true @@
        Array.init m @@ fun i -> ss.(i) > ss.(i + m) in
  print_endline @@
  if solve @@ 1 lsl n then "Yes" else "No"

