/* Simplicity and Goodness */

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

using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) { cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 1e6+2;


int main()
{
   int n;
   scn(n);

   vi a(n);

   for(int& it : a)
      scn(it);

   int k = -1, cnt = 0;

   rep(i, 2, 1001) {
      int c = 0;
      rep(j, 0, n) {
         if(a[j] % i == 0)
            c++;
      }
      if(c > cnt) {
         cnt = c;
         k = i;
      }
   }

   prin(k);

   return 0;
}
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=long long>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class T>auto comp_pairs_by_second(){return[](const T&p1,const T&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);};}

int main()
{
    ll n=in();
    map<ll,ll>gcddo;
    for(ll i=0;i<n;++i){
        ll a=in();
        for(ll j=1;j*j<=a;++j){
            if(a%j==0){
                if(j!=1)++gcddo[j];
                if(j*j!=a)++gcddo[a/j];
            }
        }
    }
    ll ans,g=0;
    for(auto gg:gcddo){
        if(gg.second>g){
            g=gg.second;
            ans=gg.first;
        }
    }
    cout<<ans<<endl;
}
