#include <bits/stdc++.h>
using namespace std;
#define ll long long


int main()
{
    ll n,i,x;
    ll c=0,d=0,p=0,q=0;
     cin>>n;
        n=(ll)pow(2,n);
        ll a[n];
        for(i=0;i<n;i++){
            cin>>x;
            a[i]=x;
            if(i<(n/2)){
                if(x>c){
                  p=i+1;
                  c=x;
                }
            }
            else{
                if(x>d){
                    d=x;
                    q=i+1;
                }
            }
        }

        if(a[p-1]>a[q-1]){
            cout<<q<<endl;
        }
        else{
            cout<<p<<endl;
        }




    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <complex>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

#include <chrono>
#include <random>
#include <cassert>

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(a) { cerr << #a << " = " << a << endl;}
#define debugV(vec) { cerr << #vec << " : "; for(auto v : vec) cerr << v << " "; cerr << endl; }
#define debug2D(vec2D, w) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } } 
#define debugVP(vec) { cerr << #vec << " : ";  for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;}
#define debug2DP(vec2D) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } }

typedef long long ll;

constexpr ll INF = 1e14; //32 ~2*10^10 //64 ~9*10^19
//constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;
const double EPS = round(1e-6);
const char en = '\n';

/*
struct Edge {
	Edge(int _s, int _t, ll _cost = 1) : from(_s), to(_t), cost(_cost) {};
	int from, to;
	ll cost;
	//ll fee;
};
*/
//typedef ll Edge;7
struct Edge {
	int id ;
	int from, to;

	Edge() {id = from = to = -1;};
	Edge(int a, int b , int c) : id(a), from(b), to(c) {};
};
typedef vector<vector<Edge>> Graph;
/*
void add_edge(Graph& g, int from, int to, ll cost = 1) {
	g[from].push_back(Edge(from, to, cost));
}
*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

void solve() {
  ll n; cin >> n;
	ll m = round(pow(2, n));
	vector<pair<int,ll>> a(m);
	
	rep(i, m) {
		int ai; cin >> ai;
		a[i] = {i, ai};
	}

	rep1(i,n) {

		if (i == n) {
			if (a[0].second < a[1].second) {
				cout << a[0].first+1 << endl;
			}
			else {
				cout << a[1].first + 1 << endl;
			}
		}
		m /= 2;
	  rep(j, m) {
			if (a[2 * j].second < a[2 * j + 1].second) {
				a[j] = a[2 * j + 1];
			}
			else {
				a[j] = a[2 * j];
			}
	  }
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	//rep(i,3)
	solve();

}