#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, n) for (int i = (int)(l); i < (int)(n); i++)
#define drep(i, n, l) for (int i = (int)(n); i > (int)(l); i--)
#define INF INT_MAX
#define INFF (pow(2,64))
#define def (200007)
#define MOD (1000000007)
typedef int64_t intt;
typedef vector<int> veci;
typedef vector<vector<int>> Veci;
typedef vector<int64_t> vecit;
typedef vector<vector<int64_t>> Vecit;
typedef vector<vector<double>> Vecd;
typedef vector<double> vecd;
typedef pair<intt, intt> P;
typedef unordered_set<int> uset;
typedef unordered_set<intt> usett;

int main(){
  int N;cin>>N;
  int max=0;
  veci a;
  int maxa=0;
  int gcd;
  rep(i,0,N){
    int A;cin>>A;
    a.push_back(A);
    maxa=maxa>A?maxa:A;
  }
  rep(i,2,maxa+1){
    int at_sum=0;
    rep(j,0,N){
      if(a[j]%i==0)at_sum++;
    }
    if(max<at_sum){
      gcd=i;
      max=at_sum;
    }
  }
  cout<<gcd<<endl;
}
#include<iostream>

int main(){
  int max_gcd = 0, ans = 0;
  int n;
  std::cin >> n;
  int a[n];
  for(int i=0; i < n; i++){
    std::cin >> a[i];
  }
  for(int h=2; h < 1000; h++){
    int gcd=0;
    for(int i=0; i < n; i++){
      if(a[i] % h == 0){
        gcd++;
      }
    }
    if(gcd > max_gcd){
      max_gcd = gcd;
      ans = h;
    }
  }
  if(!ans){
    std::cerr << "error" << std::endl;
  }else{
    std::cout << ans << std::endl;
  }
}