#include <bits/stdc++.h>
using namespace std;

int main() {

  int N;
  cin >> N;
  vector<int> A(pow(2,N));
  for (int i = 0; i < pow(2,N); i++) {
  	cin >> A.at(i);
  }
  vector<int> B(pow(2,N)); //勝ち残った選手のベクトル
  for (int i = 0; i < pow(2,N); i++){
    B.at(i) = i; 
  } // 初期値はすべての選手
  for (int i = 0; i < N-1; i++){ // 決勝手前まで
    for (int j = 0; j < pow(2 , (N-i-1)); j++)
      if (A.at(B.at(2*j)) > A.at(B.at(2*j+1))){
        B.at(j) = B.at(2*j);
      }
      else {
        B.at(j) = B.at(2*j+1);
      }
  }
  // 決勝で負ける方を出力 ただし1ずらす
  if (A.at(B.at(0)) > A.at(B.at(1))){
    cout << B.at(1) + 1 << endl;
  }
  else {
    cout << B.at(0) + 1 << endl;
  }
}

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define p push
#define pp pop
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define maxe *max_element
#define mine *min_element
#define B begin()
#define E end()
#define rB rbegin()
#define rE rend()
#define L size()
#define C count()
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

typedef long long int ll;
#define V(type) vector<type>
#define PQ(type) priority_queue<type>
#define pll pair<ll, ll>
#define F first
#define S second

#define repl(i, a, b) for(ll i=a;i<b;i++)
#define forrl(i, n) for(ll i=0;i<n;i++)
#define coll(v, n) for(int i = 0; i < n;i++){cin>>v[i];}

#define INF 9223372036854775807
const double delta = 0.0000000001;
const double pi = 3.1415926535;

void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll powM(ll x, ll y, ll m) {  //returns (a^b)%m ( ^ is exponent )
  ll ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y)
  {
    if (r & y)
    {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a);  
} 

ll lcm(ll a, ll b)
{
    ll x = gcd(a, b);
    ll ans = (a*b)/x;
    return ans;
}
bool IsPrime(long long int n){  // Returns if the passed number is prime or not.
        if (n <= 1)  return false; 
        if (n <= 3)  return true; 
  
        if (n%2 == 0 || n%3 == 0) return false; 
  
        for (ll i=5; i*i<=n; i=i+6) 
            if (n%i == 0 || n%(i+2) == 0) 
               return false; 
  
         return true; 
    }
pair<ll,ll> intersection(pair<ll,ll>x, pair<ll,ll>y)
{
    pair<ll,ll> ans;
    if(x.first<=y.first)
    {
        if(x.second<y.first){
            ans=make_pair(-1,-1);//case of no intesection
            return ans;
        }
        else{
            ans.first=max(x.first,y.first);
            ans.second=min(x.second,y.second);
            return ans;
        }
    }
    else{
        if(y.second<x.first){
            ans=make_pair(-1,-1);//case of no intersection
            return ans;
        }
        else{
            ans.first=max(x.first,y.first);
            ans.second=min(x.second,y.second);
            return ans;
        }
    }
}

ll pal(string str)
{
    string temp = str;
    reverse(temp.begin(), temp.end());

    if(temp == str)
        return 1;

    return 0;
}

int main(){
  ll n;cin>>n;
  ll num = powM(2,n,LLONG_MAX);
  ll arr[num];
  ll max =-1;
  pair<ll,ll> m1,m2;
  for(ll i=0;i<num;i++)cin>>arr[i];
  for(ll i=0;i<num/2;i++){
    if(arr[i]>max){
      max=arr[i];
      m1.first=max;
      m1.second=i+1;
    }
  }
    max=-1;
    for(ll i=num/2;i<num;i++){
        if(arr[i]>max){
         max=arr[i];
         m2.first=max;
      	 m2.second=i+1;
      }
    }
  if(m1.first<m2.first)
    	cout<<m1.second;
  else
    	cout<<m2.second;
    
}