/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define GCD(a,b) __gcd(a,b);
#define endl "\n"
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define INFLL 9223372036854775807
#define debug 0
#define MAXN   100001
#define ar array
#define lb lower_bound
#define ub upper_bound
const int mxN=2e5;
const int MOD=1e9+7;
template<typename ForwardIterator, typename T>
ForwardIterator first_less_than (ForwardIterator first, ForwardIterator last, T value)
{auto it = std::lower_bound (first, last, value);
return (it == first ? last : --it);}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}
#define debugxx(v) {for(auto x:v){cout<<x.fi<<" "<<x.se<<endl;}cout<<endl;}
#define debugx(v){for(auto y:v) {cout<<y<<" ";}cout<<endl;}
//Don't hesitate to ask me if you don't understand my code.......Happy coding,Tahmid...;
bool prime[15000000];
vector<ll>prime_list;
void seive_prime(ll n)
{
    ll i,j;
    for(i=0; i<=n; i++)
        prime[i]=true;
    for(i=2; i*i<=n; i++)
    {
        if(prime[i]==true)
        {
            for(j=i*i; j<=n; j+=i)
                prime[j]=false;
        }
    }
    prime[1]=0;
    prime[0]=0;



}

void gen_prime(ll n)
{
    seive_prime(n);
    for(ll i=0; i<=n; i++)
        if(prime[i])
            prime_list.pb(i);
}

set<ll> prime_fac(ll n)
{
    set<ll>factors;

    for(ll i=0;prime_list[i]*prime_list[i]<=n&&i<prime_list.size();i++)
    {
        if(n%prime_list[i]==0)
        {
            while(n%prime_list[i]==0)
            {
                n/=prime_list[i];
                factors.in(prime_list[i]);
            }
        }
    }

    if(n>1)
        factors.in(n);


   return factors;
}

int main()
{
    fastio;
    ll t;
    gen_prime(1010);
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n,i;
        cin>>n;
        vector<ll>v(n);

        for(i=0;i<n;i++)
            cin>>v[i];
        map<ll,ll>m;
        for(i=0;i<n;i++)
        {
            set<ll>fact=prime_fac(v[i]);
            for(auto x:fact)
            {
                m[x]++;
            }
            fact.clear();
        }
        ll maxs=-1,ans=-1;
        for(auto x:m)
        {
            if(x.se>maxs){
                ans=x.fi;
                maxs=x.se;
            }
        }

        cout<<ans<<endl;

    }
}



#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>
// #include <atcoder/all>


using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;


#define REP(i, n) for(ll i = 0; i < n; i++)





















int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
    }
    ll mx = 0, ans = 0;
    for(ll k = 2; k <= 1000; k++){
        ll cnt = 0;
        REP(i, n){
            if(a[i] % k == 0) cnt++;
        }
        if(mx < cnt){
            mx = cnt;
            ans = k;
        }
    }
    cout << ans << endl;
}