#include<bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second)return a.second < b.second;
    else return a.first < b.first;
}



int main(){
    // Failed to predict input format
    int N;cin>>N;
    VI a(N);
    rep(i, N){
        cin>>a[i];
    }
    int ret=2;
    int mm = 0;
    for(int i=2;i<1001; i++){
        int gcddo=0;
        rep(j, N){
            if(a[j]%i==0){
                gcddo++;
            }
        }
        if(gcddo > mm){
            mm = gcddo;   
            ret = i;
        }
    }
    cout<<ret<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<pair<int, string>> t(n);
    rep(i,n) cin >> t[i].second >> t[i].first;
    sort(t.rbegin(), t.rend());
    cout << t[1].second << endl;
    return 0;
}