#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
#define MAX 524300
#define reg register

using namespace std;

int n, upp;
int stk[MAX / 2], top;

struct BST {
	int root, totNd;
	int fa[MAX], ch[MAX][2], val[MAX], rec[MAX], size[MAX];
	inline int cre_node(int _val) {
		val[++totNd] = _val, size[totNd] = rec[totNd] = 1;
		return totNd;
	}
	inline void link(int u, int f, bool ind) {
		fa[u] = f, ch[f][ind] = u;
		return;
	}
	inline void upd(int u) {
		size[u] = rec[u] + size[ch[u][0]] + size[ch[u][1]];
		return;
	}
	inline void rotate(int u) {
		int f = fa[u], g = fa[f]; bool ind = ch[f][1] == u;
		link(ch[u][ind ^ 1], f, ind), link(f, u, ind ^ 1), link(u, g, ch[g][1] == f);
		upd(f), upd(u);
		return;
	}
	inline void splay(int u, int tar = 0) {
		int f = fa[u], g;
		while(f != tar) {
			g = fa[f];
			if(g != tar)
				rotate( (ch[g][1] == f) ^ (ch[f][1] == u) ? u : f );
			rotate(u), f = fa[u];
		}
		if(!tar) root = u;
	}
	void insert(int _val) {
		int u = root, f = 0;
		while(u && val[u] != _val) f = u, u = ch[u][_val > val[u]];
		if(u) {
			++rec[u], ++size[u];
		} else {
			u = cre_node(_val);
			link(u, f, _val > val[f]);
		}
		splay(u);
	}
	int find(int _val) {
		int u = root;
		while(val[u] != _val) u = ch[u][_val > val[u]];
		return u;
	}
	int pre(int _val) {
		int u = find(_val); splay(u);
		u = ch[u][0];
		while(ch[u][1]) u = ch[u][1];
		return u;
	}
	int suf(int _val) {
		int u = find(_val); splay(u);
		u = ch[u][1];
		while(ch[u][0]) u = ch[u][0];
		return u;
	}
	void del(int _val) {
		int u = find(_val); splay(u);
		if(rec[u] > 1) --rec[u], --size[u];
		else {
			int p = pre(_val), s = suf(_val);
			splay(p), splay(s, p);
			ch[s][0] = 0, fa[u] = 0;
			upd(s), upd(p);
		}
		return;
	}
	void init() {
		insert(INT_MIN), insert(INT_MAX);
		return;
	}
}lsk;

inline int Rd() {
	int x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') ch = getchar();
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	return x;
}

int main() {
	//extra_test();
	n = Rd(), upp = 1 << n;
	lsk.init();
	for(reg int i = 1; i <= upp; ++i) lsk.insert(Rd());
	stk[++top] = lsk.val[lsk.pre(INT_MAX)], lsk.del(stk[top]);
	for(reg int i = 1; i <= n; ++i) {
		int tp = top;
		for(reg int j = 1; j <= tp; ++j) {
			lsk.insert(stk[j]);
			stk[++top] = lsk.val[lsk.pre(stk[j])];
			lsk.del(stk[j]);
			if(stk[top] == INT_MIN) {
				puts("No");
				return 0;
			}
			lsk.del(stk[top]);
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 13568