#include <bits/stdc++.h> 
using namespace std;
# define Z 1000000007
# define el "\n"
# define vt vector
# define pb push_back
# define all(v) (v).begin(),(v).end()
# define ll long long int


int main()
{
	ll l;
	cin>>l;
	vt<ll>v(1<<l);
	for(ll i=0;i<(1<<l);i++){
		cin>>v[i];
	}
	auto k1 = max_element(v.begin(),v.begin()+(1<<(l-1)));
	auto k2 = max_element(v.begin()+(1<<(l-1)),v.end());
	if(*k1>*k2){cout<<k2-v.begin()+1<<el;}else{cout<<k1-v.begin()+1<<el;}

return 0; 
}



  
  
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector <long long> a(1 << n);
  for (auto &x : a) {
    cin >> x;
  }
  
  vector <int> id(1 << n);
  iota(id.begin(), id.end(), 0);
  for (int i = 0; i < n - 1; ++i) {
    int f = 1 << (i + 1);
    for (int r = f; r <= (1 << n); r += f) {
      int l = r - f;
      int x = (l + r) / 2 - 1;
      int winner = a[id[x]] > a[id[x + 1]] ? id[x] : id[x + 1];
      for (int k = l; k < r; ++k) {
        id[k] = winner;
      }
    }
  }
  
  int x = (1 << (n - 1)) - 1;
  if (a[id[x]] > a[id[x + 1]]) {
    cout << id[x + 1] + 1 << endl;
  } else {
    cout << id[x] + 1 << endl;
  }
  return 0;
}