#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
const int maxn = 1000010;
struct country {
int countryNum;
int countryScore;
};
country G[maxn];
int n;
int main()
{
cin >> n;
int countryNum = pow(2, n);
for (int i = 0; i < countryNum; i++)
{
cin >> G[countryNum + i].countryScore;
G[countryNum + i].countryNum = i + 1;
}
for (int i = countryNum - 1; i > 0; i--)
{
if (G[2 * i].countryScore > G[2 * i + 1].countryScore)
{
G[i] = G[2 * i];
}
else {
G[i] = G[2 * i + 1];
}
}
if (G[2].countryScore < G[3].countryScore)
{
cout << G[2].countryNum;
}
else {
cout << G[3].countryNum;
}
}