#include <bits/stdc++.h>
using namespace std;
int a[130], b[130], c[130];
int main() {
freopen("knockout.in","r",stdin);
freopen("knockout.out","w",stdout);
int n;
cin >> n;
int m = 1 << n;
for (int i = 1; i <= m; i++) {
cin >> a[i];
b[i] = a[i];
}
int team[130];
for (int i = 1; i <= m; i++) {
team[i] = i;
}
int cu = m;
while (cu > 1) {
int newt = 0;
for (int i = 1; i <= cu; i += 2) {
if (b[i] > b[i + 1]) {
c[++newt] = b[i];
team[newt] = team[i];
} else {
c[++newt] = b[i + 1];
team[newt] = team[i + 1];
}
}
for (int i = 1; i <= newt; i++) {
b[i] = c[i];
}
cu = newt;
}
int ca = b[1];
int ca_id = team[1];
for (int i = 1; i <= m; i++) {
b[i] = a[i];
team[i] = i;
}
cu = m;
while (cu > 2) {
int newt = 0;
for (int i = 1; i <= cu; i += 2) {
if (b[i] > b[i + 1]) {
c[++newt] = b[i];
team[newt] = team[i];
} else {
c[++newt] = b[i + 1];
team[newt] = team[i + 1];
}
}
for (int i = 1; i <= newt; i++) {
b[i] = c[i];
}
cu = newt;
}
int f1 = b[1];
int f2 = b[2];
int id1 = team[1];
int id2 = team[2];
if (f1 > f2) {
cout << id2;
} else {
cout << id1;
}
return 0;
}