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

int read()
{
	int i=0;char ch;
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)) {i=i*10+ch-'0';ch=getchar();}
	return i;
}

int gcd(int x, int y) { return (y == 0 ? x : gcd(y, x % y)); }
int n, a[22222], b[1111], Ans = 0;
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; ++ i) cin >> a[i];
	for(int i = 1; i <= n; ++ i) 
		for(int j = 2; j <= 1000; ++ j)
			if(a[i] % j == 0) b[j] ++;
	for(int i = 1; i <= 1000; ++ i)
		if(b[i] > b[Ans]) Ans = i;
	cout << Ans;
	return 0;
}
// Submitted by Sir GaLaHaD
#include <bits/stdc++.h>
#include <chrono>
/*--------------*/
#define test(t) for(cin>>t;t;--t)
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,k,n) for(ll i=k;i<n;i++)
#define repr_r(i,n) for(ll i= n-1;i>=0;i--)
/*--------------*/
#define fall(it,a) for(auto it =a.begin();it!=a.end();it++)
#define fall_r(it,a) for(auto it =a.rbegin();it!=a.rend();it++)
#define all(a) a.begin(),a.end()
#define fill(vis,v) memset(vis,v,sizeof(vis))
/*--------------*/
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
/*--------------*/
#define pb push_back
#define f first
#define sec second
#define in cin>>
#define out cout<<
#define MAX 1e9
//#define PQ
#define optimize ios_base::sync_with_stdio(0);cin.tie(NULL)

using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef unordered_map<ll ,ll>umll;
typedef unordered_set<ll>usll;
typedef set<ll>sll;
typedef map<ll,ll>mll;
typedef priority_queue<ll>pq_ll;
typedef priority_queue<ll,vll,greater<ll>>pq_pll;
typedef priority_queue<pll> pq_gll;
typedef priority_queue<pll,vpll,greater<pll>> pq_gpll;
#ifdef PQ
struct comp
{
  bool operator()(const pll &a,const pll &b)
  {
    if(a.sec==b.sec)
        return a.f>b.f;
    return a.sec>b.sec;
  }
};
#endif


int main()
{
    optimize;
    ll n;
    in n;
    ll arr[n];
    rep(i,n)in arr[i];
    ll ans=0,num=2;
    ll Max =  *max_element(arr,arr+n);
    for(int i=2;i<=Max;++i)
    {
    	ll count=0;
    	rep(j,n)
    	{
    		if(arr[j]%i==0)
    			count++;
    	}
    	if(count>ans)
    	{
    		ans=count;
    		num=i;
    	}
    }
    out num<<endl;
}