#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;
const int N_MAX = 100001;
const int modint = 1000000007;

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }
  
vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
      if (n % i == 0) {
          ret.push_back(i);
          if (i * i != n) ret.push_back(n / i);
      }
  }
  sort(ret.begin(), ret.end()); // 昇順に並べる
  return ret;
}

int main(){

  struct member{
    int num;
    int rate;
  };

  int n;
  cin >> n;

  vector<member> a;
  member temp;
  int r;
  rep(i,pow(2,n)){
    cin >> r;
    temp.num = i+1;
    temp.rate = r;
    a.push_back(temp);
  }

  while(a.size() > 2){
    for(int i = 0;i < pow(2,n-1);i++){
      if(a[i].rate < a[i+1].rate){
        a.erase(a.begin()+i);
      }
      else{
        a.erase(a.begin()+i+1);
      }
    }
    n -= 1;
    // printf("%d\n",a.size());
  }
  if(a[0].rate > a[1].rate){
    cout << a[1].num << endl;
  }
  else{
    cout << a[0].num << endl;
  }
}
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int power(int n, int exp){
  int x = 1;
  for (int i = 0; i < exp; ++i){
    x *= n;
  }
  return x;
}

int main(){
  int N;
  cin >> N;
  int NUMMAX = power(2, N);
  vector<int> A(NUMMAX);
  for (int i = 0; i < NUMMAX; ++i) cin >> A[i];
  vector<bool> isAlive(NUMMAX, true);

  int l,r;
  for (int i = 0; i < N; ++i){
    l = 0;
    r = -1;
    int num = power(2, N - i);
    for (int j = 0; j < num/2 ; ++j){
      for(l = r + 1; isAlive[l] == false && l < NUMMAX; ++l);
      for(r = l + 1; isAlive[r] == false && r < NUMMAX; ++r);
      if(A[l] < A[r]) isAlive[l] = false;
      else isAlive[r] = false;
    }
  }

  if(isAlive[l]) cout << r+1 << endl;
  else cout << l+1 << endl;
  
  return 0;
}
