#include <iostream>
#include <vector>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <bits/stdc++.h>
using namespace std;
using p = pair<int,int>;

int main(){
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t N;
  cin >> N;
  int64_t X = (1 << N);
  N = X/2;
  vector<p> A(N);
  vector<p> B(N);
  for (int i=0; i < N; i++) {
    cin >> A[i].first;
    A[i].second = i+1;
  }
  for (int i=0; i < N; i++) {
    cin >> B[i].first;
    B[i].second = i+N+1;
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  int res = 0;
  if (A[N-1].first < B[N-1].first) {
    res = A[N-1].second;
  } else {
    res = B[N-1].second;
  }
  cout << res << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define endl "\n"
#define int long long int
int number=1,number1;
void solve()
{
	vector<pair<int,int>> vec;
int n;
cin>>n;

for(int i=1;i<=pow(2,n);i++)
{
	cin>>number;
	vec.push_back({number,i});
}


	

while(vec.size()>2)
{
vector<pair<int,int>> vec1;

for(int i=0;i<vec.size()-1;i=i+2)
{
if(vec[i].first>vec[i+1].first)
{
vec1.push_back(vec[i]);
}
else
{
vec1.push_back(vec[i+1]);
}
}

vec=vec1;


}


if(vec[0].first<vec[1].first)cout<<vec[0].second<<endl;
else cout<<vec[1].second<<endl;


vec.clear();

}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("Input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("Output.txt", "w", stdout);
#endif
	int t=1;
	//cin >> t;
	while (t > 0)
	{
      solve();
		--t;
	}
	return 0;
}