#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>


using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e16;
const long double PI=3.14159265358979323; 
const long long int pl=1100;
const long double eps =0.0000001;


long long int N,sum=0,A[200200],B[200200],M=0,id;

int main()
{
    cout << fixed << setprecision(18);
    //入力
    cin>>N;
    for (long long int i = 0; i < (1<<N); i++)
    {
        cin>>A[i];
        if(M<A[i]){M=max(M,A[i]);id=i;}
    }
    if(id<(1<<(N-1))){
        id=0;
        M=0;
        for (long long int i = (1<<(N-1)); i < (1<<N); i++)
        {
            if(M<A[i]){M=max(M,A[i]);id=i;}
        }
        cout<<id+1<<endl;
        
    }else{
        id=0;
        M=0;
        for (long long int i = 0; i < (1<<(N-1)); i++)
        {
            if(M<A[i]){M=max(M,A[i]);id=i;}
        }
        cout<<id+1<<endl;
    }

    
    
    
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf=0x3f,INF=0x3f3f3f3f; const ll LLINF=0x3f3f3f3f3f3f3f3f;
#define siz(x) (int)x.size()
#define af(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define fil(x, y) fill(af(x), y)
#define pb push_back
#define lb lower_bound
#define ub upper_bounn
#define f first
#define s second	
#define lc i << 1
#define rc i << 1 | 1
const int mod = 1e9 + 7;
ll fpow(ll a, ll b){ll ret=1;while(b){if(b&1)ret=ret*a%mod;a=a*a%mod,b>>=1;}return ret;}
ll inv(ll x){return x ? fpow(x, mod - 2) : 1;}
void madd(int &a, int b){a+=b;if(a>=mod)a-=mod;}
void msub(int &a, int b){a+=mod-b;if(a>=mod)a-=mod;}
const int MM = 2e5 + 5;
 
void solve(){
	int n;
	cin >> n;
	vector<pii> a(1<<n);
	for (int i = 0; i < ( 1 << n); i++) cin >> a[i].first, a[i].second = i + 1;
	for (int i = n; i > 1; i--){
		vector<pii> b;
		for (int j = 0; j < (1 << i); j += 2){
			b.pb(max(a[j], a[j + 1]));
		}
		swap(a, b);
	}
	if (a[0].first > a[1].first) cout << a[1].second << '\n';
	else cout << a[0].second << '\n';
		
		
}
/*
 * do i rlly need to check everything????
 */	
 
int main(){
	cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--) solve();
}
