#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[(1<<n)];
    int maxi = -1,ind;
    for(int i=0;i<(1<<n);i++) {
        cin>>a[i];
        if(maxi<a[i]){
            maxi=a[i];
            ind=i;
        }
    }
    if(ind >= (1<<(n-1)) ){
        maxi=-1;
        for(int i=0;i<(1<<(n-1));i++){
            if(maxi<a[i]){
                maxi=a[i];
                ind=i;
            }
        }
        cout<<ind+1<<endl;
    }
    else{
        maxi=-1;
        for(int i=(1<<(n-1));i<(1<<n);i++){
            if(maxi<a[i]){
                maxi=a[i];
                ind=i;
            }
        }
        cout<<ind+1<<endl;
    }
}
#include <bits/stdc++.h> 
using namespace std;
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define speed   ios::sync_with_stdio(false), cin.tie(0) , cout.tie(0)
#define fillm(m,r,c,k) fr(i,0,r)fr(j,0,c)m[i][j]=k;
#define prm(m,r,c) fr(i,0,r){fr(j,0,c){cout<<m[i][j]<<" "; }cout<<endl;}
#define pr(a,n)fr(i,0,n)cout<<a[i]<<",";cout<<endl;
#define endl '\n'
#define MOD 1000000007
#define INF 1000000000
#define prv(v) for(auto x: v)cout<<x<<" ";cout<<endl;
#define MAX 400005
#define all(x) x.begin(),x.end()
#define mkp make_pair 
#define ll long long
#define f first
#define s second
int main(){
    speed;
    int n;
    cin>>n;
    queue<pair<int,int> > q;
    fr(i,1,(1<<n)+1){
        int x;cin>>x;
        q.push({x,i});
    }
    for(int i  = 1 ; i <= n - 1 ; i++){
        queue<pair<int,int> > temp;
        while(q.size() > 0){
             pair<int,int> x = q.front();
             q.pop();
             pair<int,int> y = q.front();
             q.pop();
             if(x.f  > y.f)
                temp.push(x);
             else
                temp.push(y);
        }
        swap(temp,q);
    }
    pair<int,int> x = q.front();
             q.pop();
             pair<int,int> y = q.front();
             q.pop();
    if(x.f < y.f){
        cout<<x.s<<endl;
    }
    else{
        cout<<y.s<<endl;
    }
    return 0;

}