#include<iostream>
#include <utility>
using namespace std;
typedef pair<int ,int > Node;
Node a[150] ,tree[600]; //pair<int ,int >存储国家id和国家能力值
void built(int node,int start,int end);
Node maxs(Node t1,Node t2);
Node mins(Node t1,Node t2);
int main()
{
int n;
cin>>n;
for(int i=1;i<=1<<n;i++)
{
a[i].first=i;
cin>>a[i].second;//输入国家id和国家能力值
}
built(1,1,1<<n);
cout<<mins(tree[2],tree[3]).first<<endl;//输出亚军的编号
return 0;
}
void built(int node,int start,int end)
{
if(start==end)
{
tree[node]=a[start];
return ;
}
int mid=(start+end)/2;
int left=node*2;
int right=node*2+1;
built(left,start,mid);
built(right,mid+1,end);
tree[node]=maxs(tree[left],tree[right]);
}
Node maxs(Node t1,Node t2)
{
return t1.second>t2.second ? t1:t2;
}
Node mins(Node t1,Node t2)
{
return t1.second<t2.second ? t1 : t2;
}