#include <bits/stdc++.h>
//#include "debugger.h"
#define int long long
using namespace std;

int gcd (int a, int b) {
	if (b == 0)
		return a;
		
  return gcd(b, a % b);
}
 
int lcm (int a, int b) {
    return (a / gcd(a, b)) * b;
}
  
signed main() {
		
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    
	int n;
	cin >> n;

	int Lcm = 1;
	for (int i = 2; i <= n; i++) {
		Lcm = lcm (Lcm, i);
	}
	
	cout << Lcm + 1;
	return 0;
}

#include<bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
 
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl
#define MIN(x,y) x=min(x,y)
#define MAX(x,y) x=max(x,y)
#define left 0
#define right 1
 
const double one = 1.0;
const double PI = 3.14159265/*358979323846*/;
const ll maxn = 1e4+10;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	ll an = n;
	n = 1;
	FOR(i,0,an)n*=2;
	vector<ll> vl(n);
	map<ll,ll> pos;
	FOR(i,0,n)
	{
		cin>>vl[i];
		pos[vl[i]] = i;
	}
	ll ans = 0;
	while(1)
	{
		vector<ll> winner;
		if(vl.size() == 2)
		{
			if(vl[0]>vl[1])ans = vl[1];
			else ans = vl[0];
			break;
		}
		for(int i = 0;i<vl.size();i+=2)
		{
			ll a = vl[i],b = vl[i+1];
			if(a<b)winner.pb(b);
			else winner.pb(a);
		}
		vl = winner;
	 } 
	cout<<1+pos[ans]<<Endl;
	return 0;
}