#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> S(N);
  for(int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  int god = 0;
  int e = 0;
  int ans = 2;
  for(int i = 2; i < 1001; i++) {
    for(int j = 0; j < N; j++) {
      if(S.at(j) % i == 0) god++;
    }
    if(god > e){
      ans = i; e = god;
    }
    god = 0;
  }
  cout << ans << endl;
}
/*Bismillahi-r-Rahmani-r-Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define  ll         long long
#define  pi         acos(-1.0)
#define  mod        1000000007
#define  yes        cout<<"YES"<<endl
#define  no         cout<<"NO"<<endl
#define  vi         vector<int>
#define  vl         vector<ll int>
#define  pb         push_back
#define  test       cin>>t;while(t--)
#define  lcm(a,b)   a*b/__gcd(a,b)
#define  sd         second
#define  ft         first

int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,cnts=0,w;
     cin>>n;
    ll int ara[n];
     for(i=0;i<n;i++){
        cin>>ara[i];
     }
     if(n==1){
        cout<<ara[0]<<endl;return 0;
     }
     sort(ara,ara+n);
     m=0;
     p=ara[0];
     for(i=0;i<n-1;i++){
        l=0;r=ara[i];
        for(j=i+1;j<n;j++){
            if(__gcd(r,ara[j])>1){
                l++;
                r=__gcd(r,ara[j]);
            }
        }
        if(l>m){
            m=l;
            p=r;
        }
     }
     cout<<p<<endl;





}
