#include"iostream" #include"algorithm" #include"cstring" #include"cstdio" #include"cmath" #include"vector" #include"map" #include"set" #include"queue" usingnamespace std; constint MAXN = 5e5 + 20; //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all(x) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) typedeflonglong ll; constint P = 1e9 + 9; int n; int A[MAXN];
int son[MAXN * 20][2] , wf[MAXN * 20] , fa[MAXN * 20] , cnt = 1; int nd[MAXN] , val;
voidadd( int u = 1 , int dep = 0 ){ swap( son[u][0] , son[u][1] ); swap( wf[son[u][0]] , wf[son[u][1]] ); if( dep == n - 1 ) return; add( son[u][( val >> dep ) & 1] , dep + 1 ); }
intgv( int u , int dep = n - 1 ){ if( dep == -1 ) return0; returngv( fa[u] , dep - 1 ) | ( wf[u] << dep ); }
voidsolve(){ cin >> n; rep( i , 0 , ( 1 << n ) - 1 ) { scanf("%d",A + i); int cur = 1; rep( k , 0 , n - 1 ) { int tw = ( A[i] >> k ) & 1; if( !son[cur][tw] ) ++ cnt , son[cur][tw] = cnt , fa[cnt] = cur , wf[cnt] = tw; cur = son[cur][tw]; } nd[i] = cur; } int N = 1 << n;
vi ops;
for( int i = 0 ; i < N / 2 ; ++ i ) { if( !( A[i + N / 2] >> n - 1 ) ) { int x = gv( nd[i + N / 2] ) ^ val , v = ( ( x & ( 1 << n ) - 1 ) ^ ( 1 << n ) - 1 ); val ^= v; // cout << v << endl; ops.pb( v ) , ops.pb( -1 ); add( ); } }
int v = ( gv( nd[0] ) ^ val ); val ^= v; ops.pb( v );
rep( i , 0 , N - 1 ) { if( ( gv( nd[i] ) ^ val ) != i ) { puts("No"); exit( 0 ); } } puts("Yes"); cout << ops.size() << endl; for( int x : ops ) printf("%d ",x); puts(""); }