#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++) 
#define rep(i,a,n) for (int i = a; i < n; i++)
#define SORT(s) sort(s.begin(), s.end())
#define vi vector<int>
#define vll vector<ll> 
#define vs vector<string> 
using namespace std;
typedef long long ll;

int main() {
  
  int n;
  cin >> n;
  
  int m = pow(2,n);
  
  vi a(m/2), b(m/2);
  REP(i,m) {
    if(i < m/2) cin >> a[i];
    else cin >> b[i-m/2];
  }
  
  int amax = 0, bmax = 0, a1, b1;
  REP(i,m/2) {
    if (amax < a[i]) {
      amax = a[i];
      a1 = i+1;
    }
    if (bmax < b[i]) {
      bmax = b[i]; 
      b1 = i+m/2+1;
    }
  }
  
  cout << (amax < bmax ? a1 : b1) << endl;
  
  return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[(1<<n)];
    int maxi = -1,ind;
    for(int i=0;i<(1<<n);i++) {
        cin>>a[i];
        if(maxi<a[i]){
            maxi=a[i];
            ind=i;
        }
    }
    if(ind >= (1<<(n-1)) ){
        maxi=-1;
        for(int i=0;i<(1<<(n-1));i++){
            if(maxi<a[i]){
                maxi=a[i];
                ind=i;
            }
        }
        cout<<ind+1<<endl;
    }
    else{
        maxi=-1;
        for(int i=(1<<(n-1));i<(1<<n);i++){
            if(maxi<a[i]){
                maxi=a[i];
                ind=i;
            }
        }
        cout<<ind+1<<endl;
    }
}