#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <set>
#include <functional>
#include <map>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
using Interval = pair<ll,ll>;
using Graph = vector<vector<ll> >;


template<class T> void chmax(T& a, T b){
    if (a < b){
        a=b;
    }
}

template<class T> void chmin(T& a, T b){
    if (a > b){
        a=b;
    }
}



int main(){
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];

    ll ans;
    ll maxnum = 0;
    repi(i,2,1001){
        ll num = 0;
        rep(j,N){
            if (a[j] % i == 0) num++;

        }
        if (num >= maxnum){
            maxnum = num;
            ans = i;
        }

    }
    cout << ans << endl;
}
#include <bits/stdc++.h>

#define ll                 long long
#define sf                 scanf
#define pf                 printf
#define nl                 printf("\n")
#define endl               '\n'
#define pb                 push_back
#define rep(i,a,b)         for(int i=a; i<b; i++)
#define repr(i,a,b)        for(int i=a; i>=b; i--)
#define TEST               int Test;cin>>Test;for(int _t=1;_t<=Test;_t++)
#define isValid(a,b,A,B)   (0<=a&&a<A) and (0<=b&&b<B)

using namespace std;

template <typename... T> void read(T &... args){ ((cin >> args), ...); }

void yes(){ pf("Yes\n"); }
void no() { pf("No\n"); }

typedef pair<int,int> Pr;

int main()
{	
	int n,x;
	vector<Pr> vec,temp;
	read(n);
	n = pow(2,n);
	rep(i,0,n) read(x), vec.pb(Pr(x,i+1));
	while(vec.size()>2){
		for(int i=0; i<(int)vec.size(); i+=2){
			if(vec[i].first>vec[i+1].first)
				temp.pb(vec[i]);
			else temp.pb(vec[i+1]);
		}
		vec.clear();
		for(auto w : temp) vec.pb(w);
		temp.clear();
	}
	int ans;
	if(vec[0].first<vec[1].first) ans = vec[0].second;
	else ans = vec[1].second;
	pf("%d\n",ans);
	return 0;
}
