#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll bit=1;
  rep(i,n){
    bit*=2;
  }
  vector<ll> a(bit),c(bit);
  rep(i,bit){
    cin >> a.at(i);
  }
  c=a;
  ll ans=0;
  for(int i=0;i<n;i++){
    vector<ll> b;
    for(ll j=0;j<bit;j+=2){
      ll p=max(a.at(j),a.at(j+1));
      b.push_back(p);
      if(i==n-1){
        ans=min(a.at(j),a.at(j+1));
      }
    }
    bit/=2;
    a=b;
  }
  ll ct=1;
  for(auto q: c){
    if(q==ans){
      cout << ct;
    }
    ct++;
  }
}
    

#ifdef _DEBUG
#include "../../../library/src/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <functional>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

struct init {
    init() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} init_;

int main() {

    int N;
    cin >> N;
    N = 1 << N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    auto l = max_element(A.begin(), A.begin() + N / 2);
    auto r = max_element(A.begin() + N / 2, A.end());

    cout << (*l < *r ? l : r) - A.begin() + 1 << '\n';

    return 0;
}
