object Main extends App {
  import collection.mutable.PriorityQueue
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt
  val Ss = Seq.fill(1 << N)(sc.nextInt)
  val bn, ub = PriorityQueue[Int]()

  def go(xs: PriorityQueue[Int], ys: PriorityQueue[Int]): Boolean = {
    xs.clone.dequeueAll.foreach{x =>
      if (ys.isEmpty) return true
      if (x <= ys.head) return false
      xs.enqueue(ys.dequeue)
    }
    go(xs, ys)
  }

  Ss.foreach(ub.enqueue(_))
  bn.enqueue(ub.dequeue)
  println(if (go(bn, ub)) "Yes" else "No")
}