#include<bits/stdc++.h>
using namespace std;
int n,dw=2;
int x=1,y=1,z=1,w=1;
int main() {
cin>>n;
while(n>1) {
n--;
dw=2*dw;
}
int bss[dw+1];
for(int i=1; i<=dw/2; i++) {
cin>>bss[i];
}
int bsx[dw+1];
for(int i=dw/2+1; i<=dw; i++) {
cin>>bsx[i];
}
for(int i=1; i<=dw/2; i++) {
if(x<bss[i]) {
x=bss[i];
y=i;
}
}
for(int i=dw/2+1; i<=dw; i++) {
if(z<bsx[i]) {
z=bsx[i];
w=i;
}
}
if(x>z)
cout<<w;
else
cout<<y;
return 0;
}