#include<bits/stdc++.h>

using namespace std;

const int N = 1e5+10;
int a[N];
int main()
{
	int n;
	cin>>n;
	int maxn1=0,st1=0;
	int maxn2=0,st2=0;
	for(int i=1;i<=(1<<n);i++)
	{
		cin>>a[i];
		if(i<=(1<<(n-1)))
		{
			if(a[i]>maxn1)
			{
				st1=i;
				maxn1=a[i];
			}
			
		}
		else {
			if(a[i]>maxn2)
			{
				maxn2=max(maxn2,a[i]);
				st2=i;
			}
		}
	}
	if(maxn1<=maxn2)
	{
		cout<<st1<<endl;
	}
	else {
		cout<<st2<<endl;
	}
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#include <vector>
int main() {
 int N;
  cin>>N;
  vector<int>vec(pow(2,N));
  for(int i=0;i<pow(2,N);++i){
    cin>>vec.at(i);
  }
    map<int,int>mp;
  for(int i=0;i<pow(2,N);++i){
    mp[vec[i]]=i+1;
  }
  while(vec.size()>2){
    vector<int>vec2;
    for(int i=0; i<vec.size();i+=2){
      vec2.push_back(max(vec[i],vec[i+1]));
    }
    swap(vec,vec2);
  }
  int ans = min(vec[0],vec[1]);
  cout<< mp[ans]<<endl;
  return 0;
   
    
}
