#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int i, j;

int func (int n){
    if (n == 0) return 1;
    int x = func(n/2);
    x *= x;
    if (n%2 == 1) x *= 2;
    return x;
}

int main(void){
    int n, num_p;
    vector<int> A;
    vector<int> tree;

    cin >> n;
    num_p = func(n);
    A.resize(num_p);
    tree.resize(num_p);

    rep (i, num_p){
        cin >> A[i];
        tree[i] = i+1;
    }

    rep (i, n-1){
        rep (j, num_p/2){
            if (A[j*2] > A[j*2+1]){
                A[j] = A[j*2];
                tree[j] = tree[j*2];
            }
            else{
                A[j] = A[j*2+1];
                tree[j] = tree[j*2+1];
            }
        }
        num_p /= 2;
    }

    if (A[0] < A[1]) cout << tree[0] << endl;
    else cout << tree[1] << endl;
    
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree <pair <T, T>, null_type, less <pair <T, T>>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
void ckmin(T& a, const T b) {a = min(a, b);}

template <typename T>
void ckmax(T& a, const T b) {a = max(a, b);}

template <typename T>
vector <T> sieve(T n) {
    vector <T> f(n+1, 1), res;
    for (T i = 2; i <= n; ++i)
        for (T j = i; j <= n; j += i)
            ++f[j];
    for (T i = 2; i <= n; ++i)
        if (f[i] == 2)
            res.eb(i);
    return res;
}

template <typename T>
T power(T a, T b) {
    T res = 1;
    while (b)
    {
        if (b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

template <typename T>
void print(vector <T> v) {
    for (T i : v) cout << i << " ";
    cout << '\n';
}

template <typename T>
void print(vector <vector <T>>& v) {
    for (vector <T>& vv : v) {
        for (T& i : vv)
            cout << i << " ";
        cout << '\n';
    }
}

template <typename T>
void read(vector <T>& v) {for (T& i : v) cin >> i;}

template <typename T>
void read(T&& t) {cin >> t;}

template <typename T, typename... Args>
void read(T&& t, Args&&... args)
{
    cin >> t;
    read(forward<Args>(args)...);
}

template <typename T>
void print(T&& t) {cout << t << '\n';}

template <typename T, typename... Args>
void print(T&& t, Args&&... args)
{
    cout << t << " ";
    print(forward<Args>(args)...);
}

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".txt").c_str(), "w", stdout);
    }
}

inline void solve()
{
    int n;
    cin >> n;
    vector <int> a(1 << n);
    for (int i = 0; i < (1 << n); ++i) cin >> a[i];
    auto x = max_element((1 << (n-1)) + all(a)) - a.begin();
    auto y = max_element(all(a) - (1 << (n-1))) - a.begin();
    print(a[x] > a[y] ? y+1 : x+1);
}

int32_t main()
{
    usaco();
    int t = 1;
    while (t--) solve();
}
