#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);
    }
    sort(a.begin(), a.end());
    int ans;
    int ansnum;
    for (int i = 2; i <= a.at(n - 1); i++) {
        int count = 0;
        for (int j = 0; j < n; j++) {
            if (a.at(j) % i == 0) {
                count++;
            }
        }
        if (i == 2) {
            ans = count;
            ansnum = 2;
        } else {
            if (ans < count) {
                ans = count;
                ansnum = i;
            }
        }
    }
    cout << ansnum << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

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; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int N;
// *********************************************************
int main(){

    cin >> N ;
    map<int,int> mp;

    int an;
    rep(i,N){
        cin >> an;
        int san = sqrt(an);
        for(int i=2; i<=san; i++){
            if(an%i == 0){
                ++mp[i];
                if(an/i != i){
                    ++mp[an/i];
                }
            }
        }
        ++mp[an];

        
    }

    int max=0;
    int ans=0;
    for(auto i=mp.begin(); i != mp.end(); i++){
        //cout << i->first << " " << i->second<<endl;
        if(max < i->second){
            max = i->second;
            ans = i->first;
        }
    }
    
    cout << ans << endl;

    return 0;
}