//
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
//
//#pragma GCC optimize(3,"Ofast","inline")
//#include<unordered_map>
//#include<unordered_set>
#include<cstdio>
#include<iostream>
#include<cmath>
#include<functional>
#include<cstring>
#include<string>
#include<cstdlib>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<stack>
#include<vector>
#include<sstream>
#include<list>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
int mod=104857601;
const int maxn=2e6+5;
int k[maxn];
int main()
{
    int n,a,b,ma=0,mb=0;
    cin>>n;
    n=1<<n;
    for(int i=1;i<=n;i++)
    {
        cin>>k[i];
    }
    n/=2;
    for(int i=1;i<=n;i++)
    {
        if(ma<k[i])
        {
            ma=k[i];
            a=i;
        }
    }
    n*=2;
    for(int i=n/2+1;i<=n;i++)
    {
        if(mb<k[i])
        {
            mb=k[i];
            b=i;
        }
    }
    if(k[a]>k[b])cout<<b;
    else cout<<a;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define PI 2*acos(0.0)
using namespace std;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    optimize();

    ll n;
    cin >> n;
    ll m=pow(2,n);
    ll ar[m];
    for(int i=0; i<m; i++)
        cin >> ar[i];
    ll mx1=*max_element(ar,ar+(m/2));
    ll mx2=*max_element(ar+(m/2),ar+m);
    ll k=min(mx1,mx2);
    for(int i=0; i<m; i++)
        if(ar[i]==k)
    {
        cout << i+1 << endl;
        break;
    }
}