#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 RBSTMap {
  constexpr int lim = 1 << 20;
  using Key = int;
  auto comp = less<Key>();
  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, rch;
    int sz, h;
    Key key;
    T val, 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;
  }
  Node pool[lim];
  Tree make(const Key& k, const T& v, Tree l, Tree r) {
    static int p = 0;
    assert(p < lim);
    Tree t = pool + p++;
    t->lch = l, t->rch = r;
    t->key = k, t->val = v;
    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 (comp(t->key, 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 (comp(k, t->key)) {
      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& v) {
    if (!rng(0, t->sz + 1)) {
      Tree l, r;
      tie(l, ignore, r) = split(t, k);
      t = make(k, v, l, r);
      return;
    }
    if (comp(k, t->key)) {
      insert(t->lch, k, v);
    } else if (comp(t->key, k)) {
      insert(t->rch, k, v);
    } else {
      t->key = k, t->val = v;
    }
    t = update(t);
  }
  void erase(Tree& t, const Key& k) {
    if (t == nil) return;
    if (comp(k, t->key)) {
      erase(t->lch, k);
      t = update(t);
    } else if (comp(t->key, k)) {
      erase(t->rch, k);
      t = update(t);
    } else {
      t = merge(t->lch, t->rch);
    }
  }
  int lower_bound(Tree t, const Key& k) {
    if (t == nil) return 0;
    if (comp(t->key, 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 (comp(k, t->key)) 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->key, 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 = RBSTMap::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: 42488