#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> a(1 << n);
    for (int i = 0; i < (1 << n); i++){
        cin >> a[i];
    }

    int leftmax = 0, rightmax = 0;
    for (int i = 0; i < (1 << n)/2; i++){
        leftmax = max(leftmax, a[i]);
    }
    for (int i = (1 << n)/2; i < (1 << n); i++){
        rightmax = max(rightmax, a[i]);
    }

    int ans = min(leftmax, rightmax);
    for (int i = 0; i < (1 << n); i++){
        if (a[i] == ans){
            cout << i+1 << "\n";
            break;
        }
    }
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (b), _a = (a); i >= _a; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = (n) - 1; i >= 0; i--)
#define debug(x) cout<<"debug : "<<x<<endl
#define debug2(x,y) cout<<"debug : "<<x<<" | "<<y<<endl
#define debug3(x,y,z) cout<<"debug : "<<x<<" | "<<y<<" | "<<z<<endl
#define debug4(x,y,z,w) cout<<"debug : "<<x<<" | "<<y<<" | "<<z<<" | "<<w<<endl
#define all(ar) ar.begin(), ar.end()
#define rall(ar) ar.rbegin(), ar.rend()
#define sz(x) ((long long)x.size())
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define mp make_pair
#define ff first
#define ss second
#define M 1000000007          // 1e9+7
#define INF 1e9    // 1e9
 
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<ll> vi;
typedef vector<int> vint;
typedef vector<string> vs;
typedef vector<vi> vvi;
 
bool cus(pair<int,int> a, pair<int,int> b){
    if(a.ff<b.ff)
        return true;
    if(a.ff>b.ff)
        return false;
    return a.ss<b.ss;
}
 
ll gcd(ll a, ll b){
    if(b==0)
        return a;
    return gcd(b,a%b);
}


void solve(){
    ll n;
    cin >> n;
    ll val = pow(2, n);
    vii a;

    ll x;
    rep(i, val){
        cin >> x;
        a.pb({x, i});
    }

    while(a.size() > 2){
        vii tmp;
        for(ll i = 0; i < a.size(); i+=2) tmp.pb(max(a[i], a[i+1]));
        a.clear();
        rep(i, tmp.size()) a.pb(tmp[i]);    
    }

    ii ans = min(a[0], a[1]);
    cout << ans.ss+1 << endl;
}

int main () 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(11);
 
    //ll t = 1;
    //cin>>t;
    //while(t--)
        solve();
 
    return 0;
}
