//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
 
//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

ll n,N,ans,i,val,ind1,ind2,val1,val2;

int main()
{

    IOS;
    
    cin>>n;

    N = 1<<n;

    ll a[N];

    for(i=1;i<=N;++i)
        cin>>a[i];
    

    for(i=1;i<=(N/2);++i)
    {
        if(a[i]>val1)
        {
            val1 = a[i];
            ind1 = i;
        }

        if(a[i+N/2]>val2)
        {
            val2 = a[i+N/2];
            ind2 = i+N/2;
        }

    }

    if(val1>val2)
        cout<<ind2<<"\n";
    else
        cout<<ind1<<"\n";

    return 0;
}
//
// Created by Bottomline2sky on 1/10/2021.
//
#include<bits/stdc++.h>
using  namespace std;
typedef long long ll;
ll result(vector<pair<ll,ll>>&p){
           if((ll)p.size() == 2){
                  if(p[0].first>p[1].first){
                        return   p[1].second;
                  }
                  else{
                       return p[0].second;
                  }
           }
           else{
                   vector<pair<ll,ll>> q;
                    for(ll i=0;i<p.size();i=i+2){
                     //   cout<<p[i].first<<" "<<p[i+1].first<<" ";
                           if(p[i].first>p[i+1].first){
                                  q.push_back(p[i]);
                           }
                           else{
                                q.push_back(p[i+1]);
                           }
                    }
               return   result(q);
           }

   }
int main(){
      int n;
            cin>>n;
              vector<pair<ll,ll>> arr;
                    for(ll i=0;i<pow(2,n);i++){
                              ll q;
                               cin>>q;
                                 arr.push_back(make_pair(q,i+1));
                    }
                       ll coffn = result(arr);
                       cout<<coffn<<endl;
}