#include <algorithm>
#include <iostream>
#include <deque>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <list>
#include <vector>

// #include <atcoder/convolution>

using namespace std;
using ll = long long;
#define len(s) static_cast<ll>(s.size())
#define rep(i, n) for (ll i = 0; i < n; i++)
#define all(c) c.begin(), c.end()

template<typename T, const char* fmt>
struct INPUT {
    T value;
    INPUT() { scanf(fmt, &value); }
    operator T() { return value; }
};
const char IC_FMT[] = "%c";
const char ILL_FMT[] = "%lld";
using IC = INPUT<char, IC_FMT>;
using ILL = INPUT<ll, ILL_FMT>;

template <typename T>
void print(T t) {
    cout << t << endl;
}

template <typename T, typename S, typename... Args>
void print(T t, S s, Args... args) {
    cout << t << ' ';
    print(s, args...);
}

template<typename... Args>
void debug(Args... args) {
    #ifdef DEBUG
    print(args...);
    #endif
}

struct Cargo {
    ll weight;
    ll value;
};

bool operator<(const Cargo& a, const Cargo& b) noexcept {
    return a.value < b.value;
}

struct Box {
    ll number;
    ll capacity;
};

bool operator<(const Box& a, const Box& b) noexcept {
    return a.capacity < b.capacity;
}

struct Query {
    ll l, r;
};

int main() {
    ILL N, M, Q;
    vector<Cargo> cargos;
    rep(i, N) {
        ILL W, V;
        cargos.push_back({W, V});
    }
    vector<Box> boxes;
    ll number = 1;
    rep(i, M) {
        ILL B;
        boxes.push_back({number, B});
        number++;
    }
    

    sort(all(cargos));
    reverse(all(cargos));
    sort(all(boxes));

    set<ll> used;
    rep(i, Q) {
        used.clear();
        ILL L, R;
        ll value = 0;
        for (auto c : cargos) {
            // debug(L, R);
            // Find box
            for (auto b : boxes) {
                if (used.count(b.number)) continue;
                if (L <= b.number && b.number <= R) continue;
                if (c.weight > b.capacity) continue;
                used.insert(b.number);
                value += c.value;
                break;
            }
        }
        print(value);
    }

    return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>

using ll = long long;

ll pow2(int x) {
    ll i=1;
    if (x == 0) return i;
    for (int k=0; k<x; k++) {
        i *= 2;
    }
    return i;
}

int main() {
    std::vector<ll> a;
    int n;

    std::cin >> n;
    a.reserve(pow2(n));
    for (ll i=1; i<=pow2(n); i++) {
        ll t;
        std::cin >> t;
        a.push_back(t);
    }

    ll m1v = 0;
    size_t m1;
    for (ll i=0; i<pow2(n-1); i++) {
        if (a.at(i) > m1v) {
            m1v = a.at(i);
            m1 = i+1;
        }
    }

    ll m2v = 0;
    size_t m2;
    for (ll i=pow2(n-1); i<pow2(n); i++) {
        if (a.at(i) > m2v) {
            m2v = a.at(i);
            m2 = i+1;
        }
    }

    std::cout << (m1v > m2v ? m2 : m1) << std::endl;

    return 0;
}
