#include<bits/stdc++.h>
using namespace std;
int main() {
queue<int>num;
vector<int>num1;
int k;
cin >> k;
double n = pow(2.0, k);
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
num.push(temp);
num1.push_back(temp);
}
while (num.size() != 2) {
int temp1 = num.front();
num.pop();
int temp2 = num.front();
num.pop();
int temp3 = temp1 > temp2 ? temp1 : temp2;
num.push(temp3);
}
int temp1 = num.front();
num.pop();
int temp2 = num.front();
int temp3 = temp1 < temp2 ? temp1 : temp2;
for (int i = 0; i < num1.size(); i++) {
if (num1[i] == temp3) {
cout << i + 1;
return 0;
}
}
return 0;
}