#include<iostream>
using namespace std;

int main(void){
    int N;
    cin>>N;
    int A[N];
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    int k,gcd=0;
    for(int i=2;i<=1000;i++){
        int gcd2=0;
        for(int j=0;j<N;j++){
            if(A[j]%i==0){
                gcd2++;
            }
        }
        if(gcd2>gcd){
            gcd=gcd2;
            k=i;
        }
    }
    cout<<k<<endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); ++(i))
typedef long long ll;
const int INF = 1001001001;

int main()
{

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    vector<ll> gcdd(1000);
    rep(i, n)
    {
        rep(j, 1000)
        {
            if (a[i] % (j + 1) == 0 && (j + 1) <= a[i])
                gcdd[j]++;
        }
    }
    gcdd[0] = 0;
    ll maxid = 0;
    ll maxval = 0;
    rep(i, 1000)
    {
        maxval = max(maxval, gcdd[i]);
        if (maxval == gcdd[i])
            maxid = i + 1;
    }
    cout << maxid;
    return 0;
}