#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;


int main(void) {
    ll N;
    cin >> N;

    ll num = 2 << (N-1);
    vector<pair<int, int>> A(num);
    rep(i, num) {
        A[i].first = i + 1;
        cin >> A[i].second;
    }

    num /= 2;
    for (int i = 0; i < N - 1; ++i) {
        for (int j = 0; j < num; ++j) {
            if (A[j * 2].second > A[j * 2 + 1].second) {
                A[j].first = A[j * 2].first;
                A[j].second = A[j * 2].second;
            } else {
                A[j].first = A[j * 2 + 1].first;
                A[j].second = A[j * 2 + 1].second;
            }
        }
    }

    if (A[0].second < A[1].second) {
        cout << A[0].first << endl;
    } else {
        cout << A[1].first << endl;
    }
    
    return 0;
}
#include<bits/stdc++.h>
#define ll long long
#define inf 1e18 
#define mod 1000000007
using namespace std;
int main()
{  
        ll n;
        cin>>n;
        vector<ll> a;
        n=pow(2,n);
        a.resize(n);
        unordered_map<ll,ll> ump;
        for(ll p=0;p<n;p++)
        {
            cin>>a[p];
            ump[a[p]]=p;
        }
        ll max1=0;
        ll max2=0;
        for(ll p=0;p<n/2;p++)
        {
            max1=max(max1,a[p]);
        }
        for(ll p=n/2;p<n;p++)
        {
            max2=max(max2,a[p]);
        }
       // cout<<min(max1,max2)<<endl;
        cout<<ump[min(max1,max2)]+1<<endl;
}