#include <bits/stdc++.h>
using namespace std;
struct s{
    int value;
    int idx;
}a[65538];
int main()
{
    int n;
    cin>>n;
    n=pow(2,n);
    for (int i=1;i<=n;i++)
	{
        cin>>a[i].value;
        a[i].idx=i;
    }
    while(n>2)
	{
        for (int i=1;i<=n;i+=2)
		{
            if (a[i].value<a[i+1].value){
                a[i/2+1].value=a[i+1].value;
                a[i/2+1].idx=a[i+1].idx;
            }
			else
			{
                a[i/2+1].value=a[i].value;
                a[i/2+1].idx=a[i].idx;
            }
        }
        n/=2;
    }
    if (a[1].value>a[2].value) cout<<a[2].idx<<endl;
	else cout<<a[1].idx<<endl;
    return 0;
}
//nik
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#define reg register
#define FOR(a, b, c) for (a = b; a <=c; a++)
#define rFOR(a, b, c) for (a = b;a >= c; a--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define SORT(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define newl "\n"
#define alls(x) x.begin(), x.end(), x.begin()
#define umap(v, t1, t2) unordered_map<t1, t2> v
#define uset(v,t1) unordered_set<t1> v
#define IOF ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using UL  =  unsigned long int;
using UI  =  unsigned int;
using ULL =  unsigned long long int;
using LI  =  long int;
using LL  =  long long;
using LF  =  double;
using LLF =  long double;
const int MOD1 = 1000000007;
/*const int MOD2 = */
/* Combinatorics Start */
int binoMax = 10000;
vector<LL> numInv(binoMax + 1), factNumInv(binoMax + 1), fact(binoMax + 1);
inline void generate_ncrp(LL p)
{   int i;numInv[0] = numInv[1] = 1;
	FOR(i, 2, binoMax)
	{	numInv[i] = numInv[p % i] * (p - p / i) % p;
	}	factNumInv[0] = factNumInv[1] = 1;
	FOR(i, 2, binoMax)
	{	factNumInv[i] = (numInv[i] * factNumInv[i - 1]) % p;
	}
	fact[0] = 1;
	FOR(i, 1, binoMax)
	{	fact[i] = (fact[i - 1] * i) % p;
	}
}
LL ncrmodp(LL n, LL r, LL p)
{	LL ans = ((fact[n] * factNumInv[r]) % p * factNumInv[n - r]) % p;
	return ans;
}
/* Combinatorics End */

LL expmodp(LL x, LL y, LL p)
{	LL res = 1;
	while (y > 0)
	{	if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}return res;
}
/* Matrix Operations Start */
struct Matrix{
	int row,col;
	vector<vector<LL> > a;
	Matrix(int r,int c){
		row=r;col=c;
		a.resize(row,vector<LL>(col,0));
;	}
    static Matrix IDM(LL n){
    	Matrix res(n,n);
    	for(int i=0;i<n;i++)res.a[i][i]=1;
    	return res;
	}
};
Matrix Matmult(Matrix A,Matrix B){
	Matrix res(A.row,B.col);
	LL i,j,k;
	FOR(i,0,A.row-1){
		FOR(j,0,B.col-1){
			FOR(k,0,A.col-1){
				res.a[i][j]=(res.a[i][j]+A.a[i][k]*B.a[k][j])%MOD1;
			}
		}
	}
	return res;
	
}
Matrix BinExp(Matrix X,LL n){
	Matrix res=Matrix::IDM(X.row);
	while(n>0){
		if(n&1){
			res=Matmult(X,res);
		}
		X=Matmult(X,X);
		n>>=1;
	}
	return res;
}
/* Matrix Operations End */

bool check(int x){
	int noct = x,z;
	int ndec = x;
	while(ndec>0){
		z = ndec%10;
		ndec/=10;
		if(z==7)return false;
	}
	while(noct>0){
		z = noct%8;
		noct/=8;
		if(z==7)return false;
	}
	return true;
	
}

int main()
{
	IOF
    int N,i,j,k,tp1,tp2;
	cin>>N;
	LL A[(1<<N)];
	FOR(i,0,(1<<N)-1){
		cin>>A[i];
	}
	vector<int> temp,temp1;
	FOR(i,0,(1<<N)-1){
		temp.push_back(i);
	}
	FOR(i,1,N-1){
		FOR(j,0,(1<<(N-i))-1){
			if(A[temp[2*j]]<A[temp[2*j+1]])temp1.push_back(temp[2*j+1]);
			else temp1.push_back(temp[2*j]);
		}
		temp.clear();
		temp.assign(all(temp1));
		temp1.clear();
	}
	if(A[temp[0]]<A[temp[1]])cout<<temp[0]+1;
	else cout<<temp[1]+1;
}