#include <bits/stdc++.h>
#define fi first
#define se second

//#define ivorysi
#define enter putchar('\n')
#define space putchar(' ')
#define pii pair<int,int>

typedef long long int64;
using namespace std;

template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) out(x / 10);
	putchar('0' + x % 10);
}
int N;
int64 res = 1;
int64 gcd(int64 a,int64 b) {
	return b == 0 ? a : gcd(b,a % b);
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	read(N);
	for(int i = 2 ; i <= N ; ++i) {
		res = res * i / gcd(i,res);
	}
	out(res + 1);enter;
}

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

#define ll long long
#define vi vector<ll>
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define pb push_back
#define endl '\n'
#define sa(x) sort((x).begin(), (x).end());
#define int long long
#define test cout<<"hello\n";
#define disp(a) 	trav(a) cout<<x<<" "; cout<<endl;

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T,typename U> std::ostream& operator<<(std::ostream& out, std::pair<T,U> a) {out<<" ("<<a.fr<<" "<<a.sc<<") "; return out;}
template<typename T,typename U> std::istream& operator>>(std::istream& in, std::pair<T,U> &a) {in>>a.fr>>a.sc; return in;}
template<typename T> static inline void sd(vector<T> &x) {sort(all(x), greater<T>()) ; }

vi a;
int solve(){
	int n;
	cin>>n;
	a.resize(1<<n);
	int mx=0, id=-1;
	rep(i,0,(1<<n)){
		cin>>a[i];
		if(a[i] > mx){
			mx=a[i];
			id=i;
		}
	}
	int st=0;
	if(id<(1<<(n-1))){
		st += (1<<(n-1));
	}
	int mm=0, ans=-1;
	// cout<<st<<endl;
	rep(i,0,(1<<(n-1))){
		if(a[st+i] > mm){
			mm = a[i+st];
			ans=i+st;
		}
	}
	cout<<ans+1<<endl;

	return 0;
}

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int testcases=1;
	//cin>>testcases;
	while(testcases--){
		solve();
	}
	return 0;	
}
