#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

ll table[1010];


map<ll, ll> prime_factor(ll n){
    map<ll, ll> res;
    for(ll i=2; i*i<=n; i++){
        while(n%i == 0){
            ++res[i];
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}


int main(){
    FILL(table, 0);
    ll n; cin >> n;
    rep(i, n){
        ll a; cin >> a;
        auto mp = prime_factor(a);
        for(auto p: mp){
            table[p.first] += 1;
            // cout << p.first << ' ' << p.second << endl;
        }
    }
    ll res, ans = -1;
    rep(i, 1002){
        // if(table[i] != 0) cout << table[i] << endl;
        if(chmax(ans, table[i])) res = i;
    }
    cout << res << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,j;
    cin>>n;
    int a[n],cnt,maxm=0,ans;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=2;i<a[0];i++){
        cnt=0;
        for(j=0;j<n;j++){
            if(a[j]%i==0){
                cnt++;
            }
        }
        if(cnt>maxm){
            maxm=cnt;
            ans=i;
        }
    }
    for(i=0;i<n;i++){
        cnt=0;
        for(j=i;j<n;j++){
            if(a[j]%a[i]==0){
                cnt++;
            }
        }
        if(cnt>maxm){
            maxm=cnt;
            ans=a[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}