#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 17;
ll n;
ll a[1 << N];
int main()
{
	scanf("%lld", &n);
	vector<pair<ll, ll>>v;
	for (ll i = 1 ; i <= (1 << n) ; i++)
	{
		scanf("%lld", &a[i]);
		v.push_back({a[i], i});
	}
	while (v.size() > 2)
	{
		vector<pair<ll, ll>>test;
		for (ll i = 0; i + 1 < v.size() ; i += 2)
		{
			if (v[i].first > v[i + 1].first)
				test.push_back(v[i]);
			else
				test.push_back(v[i + 1]);
		}
		v = test;
	}
	if (v[0].first > v[1].first)
		printf("%lld\n", v[1].second);
	else
		printf("%lld\n", v[0].second);
}
//Author: Mehedi.cm
//Created: 11 January 2021 (Monday) at 12:12 AM
#include<bits/stdc++.h>
#define w(x)            int x; cin>>x; for(int tc=1;tc<=x;tc++)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb push_back
#define pqg priority_queue<int>
#define pqs priority_queue<int,vector<int>,greater<int>>
#define mpii map<int,int>
#define endl "\n"
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define mod 1000000007
#define inp(x) cin>>x;


using namespace std;
void solve(int tc) {
	int a, b;
	cin >> a >> b;
	int c = b;
	a += b;
	b = c;
	if (a >= 15 and b >= 8) {
		cout << 1 << endl;
	} else if (a >= 10 and b >= 3) {
		cout << 2 << endl;
	} else if (a >= 3) {
		cout << 3 << endl;
	} else
		cout << 4 << endl;



}

int32_t main() {
	FIO
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	// w(x){
	solve(1);
	// }
	return 0;
}