#include <bits/stdc++.h>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 1 << 19;
int n,nn;
int t[MAX],ma[MAX],mi[MAX];
vector<int> d[MAX];
void nie(){
  cout << "NO\n";
  exit(0);
}
int reverse(int i){
  int res = 0;
  R(j,nn)if((i >> j) & 1){
    res += 1 << (nn - j - 1);
  }
  return res;
}
int res[MAX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> nn;
  n = 1 << nn;
  R(i,n){
    mi[i] = 0;
    ma[i] = n-1;
  }
  
  R(i,n){
    cin >> t[i];
    /*
    if(i == n-1){
      if(t[i] != n && t[i] != 0){
        nie();
      }
      t[i] = n;
    }
    if(i == 0){
      if(t[i] != 1 && t[i] != 0){
        nie();
      }
      t[i] = 1;
    }*/
    t[i]--;
    if(t[i] != -1){
      mi[i] = t[i];
      ma[i] = t[i];
    }
  }
  R(i,n){
    R(j,nn)if((i >> j) & 1){
      maxi(mi[i], mi[i - (1 << j)]); 
    }
  }
  for(int i = n - 1; i >= 0;i--){
    R(j,nn)if((i >> j) & 1){
      mini(ma[i - (1 << j)], ma[i]);
    }
  }
  R(i,n){
    if(ma[i] < mi[i])nie();
    debug(ma[i],mi[i]);
    d[mi[i]].PB(i);
  }
  set<PII> pom;
  R(i,n){
    for(int ak:d[i]){
      pom.insert({ma[ak],ak});
    }
    if(pom.empty())nie();
    if(ma[pom.begin()->SE] < i)nie();
    res[reverse((*pom.begin()).SE)] = i;
    pom.erase(pom.begin());
  }
  cout << "YES\n";
  R(i,n){
    cout << res[i] + 1 << " ";
  }
  cout << "\n";
  
}
