#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long ll;

int main()
{
    int n, maxcnt = 0, cnt = 0, ans = 0;
    cin >> n;
    vector<int> a(n),b(1000);
    for(int i = 0; i < n; ++i) cin >> a.at(i);
    for(int k = 2; k < 1001; ++k){
        for(int i = 0; i < n; ++i) if(a.at(i) % k == 0) cnt += 1;
        if(maxcnt < cnt){
            maxcnt = cnt;
            ans = k;
        }
        cnt = 0;
    }
    cout << ans << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define ll 				long long
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii               map<ll,ll>
#define pqi             priority_queue<ll>			//max pq
#define pqd             priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pw(b,p)         pow(b,p) + 0.1
#define f(i,k,n)			for(ll i=k;i<n;i++)

ll power(ll a, ll b, ll mod) {ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod; a = a * a % mod;} return res;}
ll power(ll a, ll b) {ll res = 1; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a ; a = a * a;} return res;}
ll min( ll a,  ll b) { return (a < b) ? a : b;}
ll max(ll a, ll b) {return (a > b) ? a : b;}
ll gcd (ll a, ll b) {if (a == 0) return  b; return gcd(b % a, a);}



void bwayne()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}



void solve() {
	ll n;
	cin >> n;
	vi a(n);
	f(i, 0, n) cin >> a[i];
	ll ans = 1;
	mii poss;
	f(i, 0, n) {
		ll el = a[i];
		for (ll j = 2; j * j <= a[i]; j++) {
			ll count = 0;
			while (el % j == 0) {
				count++;
				el /= j;
			}
			if (count >= 1) {
				poss[j]++;
			}
		}
		if (el > 1) {
			poss[el]++;
		}
	}
	mii m;
	for (auto i = poss.begin(); i != poss.end(); i++) {
		ll pos = i->first;
		f(j, 0, n) {
			if (a[j] % pos == 0) {
				m[pos]++;
			}
		}
	}
	ll maxx = 0;
	for (auto it = m.begin(); it != m.end(); it++) {
		if (it->second > maxx) {
			ans = it->first;
			maxx = it->second;
		}
	}
	cout << ans;



}
int main()
{
	bwayne();// remember
	ll t = 1;
	// cin >> t;

	for (ll tt = 1; tt <= t; tt++)
	{
		//	 cout<<"Case #"<<tt<<": ";
		solve();
	}

	return 0;
}