#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define int long long
#define FOR(i,a,b,c) for(int i=a;i<b;i+=c)
#define REV(i,a,b,c) for(int i=a;i>=b;i-=c)
#define all(x) x.begin(),x.end()                   
#define Dhruv main

const int pinf=LLONG_MAX;
const int ninf=LLONG_MIN;
const int mod=1000000007;

using namespace std;
using namespace __gnu_pbds;

typedef tree
<int,null_type,less <int>,rb_tree_tag,tree_order_statistics_node_update>
indexed_set;

typedef tree
<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>
indexed_multiset;

template <typename T>
istream & operator>>(istream &is, vector<T> &v) {
    for(auto &data:v){
    	is>>data;
    }	
    return is;
}

template <typename T>
ostream & operator<<(ostream &os,const vector<T> &v) {
    for(auto &data:v){
    	os<<data<< " ";
    }	
    return os;
}
	

int32_t Dhruv(){
	
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int T=1;

	while(T--){
		 
		 int a,b;
		 cin>>a>>b;
		 if(min(a,b)+3>max(a,b)) cout<< "Yes\n";
		 else cout<< "No\n";
	}	

	#ifdef LOCAL
    	cout<< "Time Elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<< "s\n";
    #endif                                                   
    

    return 0;

}

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <chrono>
#include <random>
#include <assert.h>
#include <functional>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 998244353 ;
long double pie = acos(-1) ;
ll INF = 1000000000000 ;
 
void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T b){	if(a<b) a = b ;}
template<class T> void chmin(T &a,T b){	if(a>b) a = b ;}

int main(){
    int n ; cin >> n ;
    V<int> a(n) ;
    for(auto &i:a) cin >> i ;
    int mx = -1 ;
    int ans = -1 ;
    for(int i=2;i<=1000;i++){
        int  cnt = 0 ;
        for(int j=0;j<n;j++) cnt += (a[j]%i==0) ;
        if(cnt>mx){
            mx = cnt ;
            ans = i ;
        }
    }
    cout << ans << endl ;
}