#include <bits/stdc++.h>
// #include <boost/multi_array.hpp>
// #include <boost/optional.hpp>
// #include <boost/range/irange.hpp>
// #include <boost/range/algorithm.hpp>
// #include <boost/range/adaptors.hpp>
// #include <atcoder/all>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, x, n) for(int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
const int INF = 1e9;
const long long llINF = 1LL << 60;

bool is_prime(long long n) { // is n prime or not
    for(long long i = 2; i * i <= n; i++) {
        if(n % i == 0)
            return false;
    }
    return true;
}

void Main() {
    int n;
    cin >> n;
    ll p = 1;
    rep(i, n) p *= 2;
    vector<int> a(p);
    rep(i, p) cin >> a[i];
    int maxa = 0, maxb = 0, ida, idb;
    rep(i, p) {
        if(i < p / 2) {
            if(a[i] > maxa) {
                maxa = a[i];
                ida = i;
            }
        } else {
            if(a[i] > maxb) {
                maxb = a[i];
                idb = i;
            }
        }
    }
    if(maxa > maxb) cout << idb + 1 << endl;
    else cout << ida + 1 << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    long N;
    cin >> N;
    set<long> ans;

    for(long i = 1; i * i <= N; i++) {
        if(N % i == 0) {
            ans.insert(i);
            ans.insert(N / i);
        }
    }

    for(auto val:ans) cout << val << endl;

    return 0;
}