#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,n) for(ll i=a;i<n;i++)
#define w(x) ll _t;cin>>_t;f(x,1,_t+1)
#define br cout<<"\n"

ll mod=1e9+7;
template<class T>
void printArr(T arr,int n){
    cout<<"\n[";f(i,0,n) cout<<arr[i]<<", ";
    cout<<"]\n";
}
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}

ll poww(ll a,ll m){
    ll res=1;
    a = a%mod;
    for(;m;m>>=1){
        if(m&1){
            res=(res*a)%mod;
        }
        a=(a*a)%mod;
    }
    return res;
}

bool cmp(pair<int,int> &a,pair<int,int> &b){
    return a.second>=b.second;
}

/*int lpf[1000001];

void createLPF(){
    f(i,0,1000001) lpf[i]=INT_MAX;
    lpf[1]=1;
    for(int i=2;i*i<=1000000;i++){
        if(lpf[i]==INT_MAX){
            lpf[i] = i;
            for(int j=2*i;j<=1000000;j+=i) lpf[j] = min(lpf[j],i);
        }            
    }
}*/



int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    
    //w(_x)//testcases
    {
        ll n;cin>>n;
        ll a[1<<n];
        f(i,0,1<<n) cin>>a[i];
        
        vector<int> notlost;
        f(i,0,1<<n) notlost.push_back(i);
        ll ans = -1;
        for(int i=0;i<n;i++){
            vector<int> newin;
            for(int j=0;j<notlost.size()-1;j+=2){
                int p1=notlost[j],p2=notlost[j+1];
                if(a[p1]>a[p2]) {newin.push_back(p1);ans = p2;}
                else {newin.push_back(p2);ans = p1;}
            } 
            notlost = newin;
        }
        cout<<ans+1;
        
    }
    return 0;
}
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
#define int long long
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset(x,y,sizeof x)
#define sz(x) (int)(x).size()
#define ln std::puts("")
#define lsp std::putchar(32)
#define pb push_back
#define MP std::make_pair
#define dbg(x) std::cerr<<__func__<<"\tLine:"<<__LINE__<<' '<<#x<<": "<<x<<"\n"
#define dprintf(x...) std::fprintf(stderr,x)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
template <class t> inline void read(t &s){s=0;
reg int f=1;reg char c=getchar();while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))s=(s<<3)+(s<<1)+(c^48),c=getchar();s*=f;return;}
template<class t,class ...A> inline void read(t &x,A &...a){read(x);read(a...);}
template <class t> inline void write(t x){if(x<0)putchar('-'),x=-x;
int buf[21],top=0;while(x)buf[++top]=x%10,x/=10;if(!top)buf[++top]=0;
while(top)putchar(buf[top--]^'0');return;}
inline void setIn(std::string s){freopen(s.c_str(),"r",stdin);return;}
inline void setOut(std::string s){freopen(s.c_str(),"w",stdout);return;}
inline void setIO(std::string s=""){setIn(s+".in");setOut(s+".out");return;}
template <class t>inline bool checkmin(t&x,t y){if(x>y){x=y;return 1;}return 0;}
template <class t>inline bool checkmax(t&x,t y){if(x<y){x=y;return 1;}return 0;}
inline int lowbit(int x){return x&(-x);}
int a[1<<16|5],loser;
inline int dfs(int l,int r)
{
	if(l==r)
		return read(a[l]),a[l];
	reg int mid=(l+r)>>1,L=dfs(l,mid),R=dfs(mid+1,r);
	loser=std::min(L,R);
	return std::max(L,R);
}
signed main(void)
{
	int n;read(n);
	dfs(1,1<<n);
	for(int i=1;i<=(1<<n);++i)
		if(loser==a[i])
			write(i),ln;
	return 0;
}

/*
 * Check List:
 * 1. Input / Output File (OI)
 * 2. long long 
 * 3. Special Test such as n=1
 * 4. Array Size
 * 5. Memory Limit (OI) int is 4 and longlong is 8
 * 6. Mod (a*b%p*c%p not a*b*c%p  ,  (a-b+p)%p not a-b )
 * 7. Name ( int k; for(int k...))
 * 8. more tests , (T=2 .. more)
 * 9. blank \n after a case
*/



