
let () = Scanf.scanf "%d\n" @@ fun n ->
  let ss =
    Array.init (1 lsl n) @@ fun _ ->
      Scanf.scanf "%d " @@ fun s -> s in
  print_endline @@
  try
    Array.sort (fun s s' -> compare s' s) ss;
    let ssq = Queue.create () in
    Array.iter (fun s -> Queue.push s ssq) ss;
    let q = Queue.create () in
    Queue.push (Queue.pop ssq, n) q;
    while not (Queue.is_empty q) do
      let (s, n) = Queue.pop q in
      for m = n - 1 downto 0 do
        let s' = Queue.pop ssq in
        if s <= s'
        then raise Not_found
        else Queue.push (s', m) q
      done
    done;
    "Yes"
  with Not_found -> "No"
