#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl;
    #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl;
    #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl;
    #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl;
#else
    #define p(x)
    #define p2(x,y)
    #define pp(x)
    #define pv(x)
    #define ppv(x)
#endif
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
const int maxp = 22;
const ld EPS = 1e-18;
const ll INF = 2e18;
const int MOD = 1e9+7;
const int N = 2e5+1;


int main(){
fastio

int n;
int i;
cin>>n;

map<int,int> cnt;

for(i=0;i<n;i++){
    int x;
    cin>>x;
    for(int j=2;j*j<=x;j++){
        if(x%j)continue;
        cnt[j]++;
        while(x%j==0){
            x/=j;
        }
    }
    if(x>1)
        cnt[x]++;
}

int ans = 0,idx;
for(auto x : cnt){
    if(x.S > ans){
        ans = x.S;
        idx = x.F;
    }
}
cout<<idx;


}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    int ans = 0, rres = 0;
    for(int i = 2; i < 1001; i++){
        int res = 0;
        for(int j = 0; j < N; j++){
            if(A.at(j) % i == 0){
                res++;
            }
        }
        if(rres <= res){
            ans = i;
            rres = res;
        }
    }
    cout << ans << endl;
    return 0;
}