#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

ll n;

ll calcsum(ll a, ll b) {
	ll x = a + b, y = b - a + 1;
	if (x % 2 == 0) x /= 2; else { assert(y % 2 == 0); y /= 2; }
	if (x > LLONG_MAX / y) return LLONG_MAX; else return x * y;
}

ll solve() {
	ll lo = 0, hi = n + 1;
	while (lo + 1 < hi) {
		ll mi = lo + (hi - lo) / 2;
		ll a = 1, b = n + 1 - mi, c = n + 1;
		ll d = calcsum(a, b);
		if (c >= d) hi = mi; else lo = mi;
	}
	return hi;
}

void run() {
	scanf("%lld", &n);
	printf("%lld\n", solve());
}

int main() {
	run();
	return 0;
}

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

int main(){
  ll n,max=0,max2=0,t,idx=1,idx2=1; 
  cin>>n;
  vector<ll> a(1<<n);
  for(ll i=0; i<(1<<(n-1)); i++){
    cin>>t;
    if(t>max){
      max=t;
      idx=i+1;
 //     cout << max << " "<< idx << endl;
    }
  }
  for(ll i=0; i<(1<<(n-1)); i++){
    cin>>t;
    if(t>max2){
      max2=t;
      idx2=i+1+(1<<(n-1));
    }
  }
  if(max<max2) cout << idx << endl;
  else cout << idx2 << endl;
  return 0;
}