#include<cstdio>
#include<vector>
#include<utility>
#include<cstdlib>
#include<queue>
#include<algorithm>

using namespace std;

typedef pair<int ,int> P;
typedef pair<P, int> PP;

const int NUM = 1 << 18;

vector<int> prv[NUM];
vector<int> nxt[NUM];

int le[NUM];
int ri[NUM];

int ans[NUM];
int N;
int M;

int in[NUM];

void input(){
	scanf("%d", &N);
	M = 1 << N;
	for(int i = 0; i < M; ++i){
		scanf("%d", in + i);
	}
}

void no(){
	printf("NO\n");
	exit(0);
}

vector<P> ps[NUM];

int rev(int x){
	int ans = 0;
	for(int i = 0; i < N; ++i){
		if((x >> i) & 1){
			ans += (1 << (N - i - 1));
		}
	}
	return ans;
}

void solve(){
	for(int i = 0; i < M; ++i){
		if(in[i] == 0){
			int id = rev(i);
			le[id] = 0;
			ri[id] = (1 << N) - 1;
		}else{
			int id = rev(i);
			le[id] = in[i] - 1;
			ri[id] = in[i] - 1;
		//	printf("%d %d\n", id, in[i] - 1);
		}
	}
	for(int i = 0; i < M; ++i){
		for(int j = 0; j < N; ++j){
			int x = i ^ (1 << j);
			if(x < i){
				prv[i].push_back(x);
			}else{
				nxt[i].push_back(x);
			}
		}
	}
	for(int i = 0; i < M; ++i){
		for(int j = 0; j < prv[i].size(); ++j){
			le[i] = max(le[i], le[prv[i][j]] + 1);
		}
	}
	for(int i = M - 1; i >= 0; --i){
		for(int j = 0; j < nxt[i].size(); ++j){
			ri[i] = min(ri[i], ri[nxt[i][j]] - 1);
		}
	}
	for(int i = 0; i < M; ++i){
		//printf("%d %d %d\n", le[i], ri[i], i);
		if(le[i] < 0 || ri[i] >= M || le[i] > ri[i]){
			no();
		}
	}
	for(int i = 0; i < M; ++i){
		ps[le[i]].push_back(P(ri[i], i));
	}
	priority_queue<P, vector<P>, greater<P> > que;
	for(int i = 0; i < M; ++i){
		for(int j = 0; j < ps[i].size(); ++j){
			que.push(ps[i][j]);
		}
		P p = que.top();
		que.pop();
		//printf("%d %d %d\n", i, p.first, p.second);
		if(p.first < i) no();
		ans[p.second] = i;
//		ans[i] = p.second;
	}
	/*
	for(int i = 0; i < NUM; ++i){
		pps[i] = PP(P(le[i], ri[i]), i);
	}
	sort(pps, pps + M);
	int cur = 0;
	for(int i = 0; i < M; ++i){
		int l = pps[i].first.first;
		int r = pps[i].first.second;
		int id = pps[i].second;
		if(cur < l || r < cur) no();
		ans[id] = cur;
		cur++;
	}*/
	printf("YES\n");
	for(int i = 0; i < M; ++i){
		printf("%d%c", ans[i] + 1, i + 1 == M ? '\n' : ' ');
	}
}

int main(){
	input();
	solve();
	return 0;
}
