#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#define debug(...)\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;

template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v) {
  for (auto & x : v) is >> x;
  return is;
}

template <typename T>
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v) {
  auto n = v.size();
  os << "{";
  for (size_t i = 0; i < n; i++)
    {os << (i > 0 ? "," : "") << v.at(i);}
  return os << "}";
}

// template <typename T>
// std::ostream& operator<< (std::ostream& os, const std::set<T>& v) {
//   os << "{";
//   for (auto x : v) std::cout << x << ",";
//   return os << "}";
// }

template <typename T>
auto make_vector_impl(size_t sz, T t) {return std::vector<T>(sz, t);}

template <size_t N, typename T, typename U, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz, U u) {return make_vector_impl(sz, T(u));}

template <size_t N, typename T, std::enable_if_t<N == 1, std::nullptr_t> = nullptr>
auto make_vector(size_t sz) {return std::vector<T>(sz);}

template <size_t N, typename T, typename... Args, std::enable_if_t<N != 1, std::nullptr_t> = nullptr>
auto make_vector(size_t a, Args... args) {return make_vector_impl(a, make_vector<N - 1, T>(args...));}

template <typename T, typename Size_t>
auto& at(T& t, Size_t i) {return t.at(i);}

template <typename T, typename Size_t, typename... Args>
auto& at(T& t, Size_t i, Args... args) {return at(t.at(i), args...);}

void err () {
  std::cout << "No" << std::endl;
  exit(0);
}

// Access the j-th bit.
auto bit_at (int x, int j) -> bool {return (x >> j) & 1;}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  auto N = 1 << n;
  std::vector<int>a(N); std::cin >> a;
  std::sort(all(a));
  std::reverse(all(a));
  // debug(a);
  auto graph = make_vector<2, int>(N, 0);
  auto prt = std::vector<int>(N);
  std::vector<int> sz(N);
  rep(i, 0, N) {
    auto tmp = i;
    auto len = 0;
    while (tmp > 0) {
      len++;
      tmp /= 2;
    }
    // debug(i, len);
    rep(p, len, n) {
      auto j = i + (1 << p);
      graph.at(i).emplace_back(j);
      prt.at(j) = i;
    }
    sz.at(i) = 1 << (n - len);
  }
  std::multiset<int, std::greater<int>> set;
  for (auto x : a) set.insert(x);
  std::vector<int> b(N, -1);
  b.at(0) = *set.begin();
  set.erase(set.begin());
  // debug(b);
  rep(i, 1, N) {
    auto it = set.upper_bound(b.at(prt.at(i)));
    if (it == set.end()) err();
    b.at(i) = *it;
    set.erase(it);
  }
  // debug(b);
  std::cout << "Yes" << std::endl;
  return 0;
}

Measured memory_bytes: 27008