#include <iostream>
#include <cmath>
using namespace std;
int teams[133] = { };
int n,N;
int main() {
cin >> n;
N = pow(2,n);
for(int i = 1; i <= N; i++){
cin >> teams[i];
}
int ansnum;
int anspos;
for(int i = 1; i <= n; i++){
if(i == n){
for(int j = 1; j <= N; j = j + pow(2,i)){
int pow_2_i_1 = pow(2,i-1);
if(teams[j] < teams[pow_2_i_1 + j]){
ansnum = teams[j];
break;
}
else{
ansnum = teams[pow_2_i_1 + j];
break;
}
}
}
else {
for (int j = 1; j <= N; j = j + pow(2, i)) {
int pow_2_i_1 = pow(2, i - 1);
if (teams[j] > teams[j + pow_2_i_1]) {
teams[j + pow_2_i_1] = -1;
}
else {
swap(teams[j], teams[j + pow_2_i_1]);
teams[j + pow_2_i_1] = -1;
}
}
}
}
for(int i = 1; i <= N; i++){
if(teams[i] == ansnum){
anspos = i;
break;
}
}
cout << anspos << endl;
return 0;
}