
// Problem: C - ABC Tournament
// Contest: AtCoder - AtCoder Beginner Contest 188
// URL: https://atcoder.jp/contests/abc188/tasks/abc188_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <iostream>
#include <cmath>
#define pii pair<int,int>
using namespace std;
pair<int, int> arr[65546];
int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n, a = -1 , b = -1, pa = -1 , pb = -1;
	cin >> n;
	n = pow(2, n);
	for (int i = 0; i < n; ++i)
		cin >> arr[i].second, arr[i].first = i+1;
	for (int i = 0, j = n-1; i < j; ++i, --j) {
		if (arr[i].second > a) {
			a = arr[i].second, pa = arr[i].first;
		}
		if (arr[j].second > b) {
			b = arr[j].second, pb = arr[j].first;
		}
	}
	if (a > b) cout << pb;
	else cout << pa;
}
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define int long long
#define endl '\n'
                            /*
ifstream in("test.txt");
#define cin in            */

void solve(){
	int n;
	cin >> n;
	n = 1 << n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	if(*max_element(a.begin(), a.begin()+n/2) < *max_element(a.begin()+n/2, a.end()))
		cout << max_element(a.begin(), a.begin()+n/2)-a.begin()+1;
	else
		cout << max_element(a.begin()+n/2, a.end())-a.begin()+1;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}

	return 0;
}