#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class Z> Z rng(Z a, Z b) {
  static mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<Z>(a, b - 1)(mt);
}
namespace RBST {
  using Key = int;
  using T = int;
  constexpr T e = 0;
  T op(const T& a, const T& b) { return a + b; }
  T op(const T& a, const T& b, const T& c) { return op(op(a, b), c); }

  struct Node;
  using Tree = Node*;
  struct Node {
    Tree lch = nullptr, rch = nullptr;
    Key k;
    int sz = 0, h = 0;
    T val = e, acc = e;
  };
  Tree nil = new Node();

  Tree update(Tree t) {
    t->sz = t->lch->sz + 1 + t->rch->sz;
    t->h = max(t->lch->h, t->rch->h) + 1;
    t->acc = op(t->lch->acc, t->val, t->rch->acc);
    return t;
  }
  Tree make(const Key& k, const T& val) {
    Tree t = new Node();
    t->lch = t->rch = nil, t->k = k, t->val = val;
    return update(t);
  }

  Tree merge(Tree l, Tree r) {
    if (l == nil) return r;
    if (r == nil) return l;
    if (rng(0, l->sz + r->sz) < l->sz) {
      l->rch = merge(l->rch, r);
      return update(l);
    } else {
      r->lch = merge(l, r->lch);
      return update(r);
    }
  }
  Tree merge(Tree l, Tree m, Tree r) { return merge(merge(l, m), r); }
  pair<Tree, Tree> lower_split(Tree t, const Key& k) {
    if (t == nil) return {nil, nil};
    if (t->k < k) {
      Tree r;
      tie(t->rch, r) = lower_split(t->rch, k);
      return {update(t), r};
    } else {
      Tree l;
      tie(l, t->lch) = lower_split(t->lch, k);
      return {l, update(t)};
    }
  }
  pair<Tree, Tree> upper_split(Tree t, const Key& k) {
    if (t == nil) return {nil, nil};
    if (k < t->k) {
      Tree l;
      tie(l, t->lch) = upper_split(t->lch, k);
      return {l, update(t)};
    } else {
      Tree r;
      tie(t->rch, r) = upper_split(t->rch, k);
      return {update(t), r};
    }
  }
  tuple<Tree, Tree, Tree> split(Tree t, const Key& k) {
    Tree l, m, r;
    tie(l, r) = lower_split(t, k);
    tie(m, r) = upper_split(r, k);
    return make_tuple(l, m, r);
  }

  void insert(Tree& t, const Key& k, const T& val) {
    Tree l, m, r;
    tie(l, m, r) = split(t, k);
    t = merge(l, make(k, val), r);
  }
  void erase(Tree& t, const Key& k) {
    Tree l, m, r;
    tie(l, m, r) = split(t, k);
    t = merge(l, r);
  }
  int lower_bound(Tree t, const Key& k) {
    if (t == nil) return 0;
    if (t->k < k) return t->lch->sz + 1 + lower_bound(t->rch, k);
    return lower_bound(t->lch, k);
  }
  int upper_bound(Tree t, const Key& k) {
    if (t == nil) return 0;
    if (k < t->k) return upper_bound(t->lch, k);
    return t->lch->sz + 1 + upper_bound(t->rch, k);
  }
  int count(Tree t, const Key& k) { return upper_bound(t, k) - lower_bound(t, k); }

  pair<Key, T> get(Tree t, int i) {
    assert(0 <= i and i < t->sz);
    if (i == t->lch->sz) return {t->k, t->val};
    if (i < t->lch->sz) return get(t->lch, i);
    return get(t->rch, i - t->lch->sz - 1);
  }
  T at(Tree& t, const Key& k) {
    if (!count(t, k)) {
      insert(t, k, e);
      return e;
    }
    return get(t, lower_bound(t, k)).second;
  }
  T acc(Tree t, int l, int r) {
    if (l <= 0 and t->sz <= r) return t->acc;
    T resl = l < t->lch->sz ? acc(t->lch, l, r) : e;
    T resr = t->lch->sz + 1 < r ? acc(t->rch, l - t->lch->sz - 1, r - t->lch->sz - 1) : e;
    T resm = l <= t->lch->sz and t->lch->sz < r ? t->val : e;
    return op(resl, resm, resr);
  }
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  // map< int, int, greater<int> > mp;
  auto mp = RBST::nil;
  for (int _ = 0; _ < 1 << n; ++_) {
    int a; cin >> a;
    // ++mp[a];
    insert(mp, a, at(mp, a) + 1);
  }
  assert(acc(mp, 0, mp->sz) == 1 << n);
  priority_queue<int> pq;
  pq.push(1 << n);
  // for (const auto& e : mp) {
  for (int idx = mp->sz - 1; idx >= 0; --idx) {
    auto e = get(mp, idx);
    if (e.second > (int)pq.size()) {
      return cout << "No" << '\n', 0;
    }
    V<> v;
    for (int _ = 0; _ < e.second; ++_) {
      v.push_back(pq.top()); pq.pop();
    }
    for (int e : v) {
      for (int i = 1; i < e; i *= 2) {
        pq.push(i);
      }
    }
  }
  cout << "Yes" << '\n';
}

Measured memory_bytes: 25472