#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);
  P p;
  p = {0,0};
  int cnt;
  
  for(int i=2; i<=1000; ++i){
    cnt=0;
    rep(j,N){
      if(A.at(j)%i==0) ++cnt;
    }
    if(p.first<cnt) p = {cnt, i};
  }
  
  cout << p.second << endl;
  
  return 0;
}
////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

namespace my {
/*汎用*/
template <typename T>
void input_vec(vector<T> &a, ll n) {
  assert(a.empty());
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  assert(a.empty());
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}

char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }

/*整数*/
ll gcd(ll a, ll b) {  // O( log(max(a,b)) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(max(a,b)) )
ll modinv(ll n, ll mod) {                               // O( log(max(n,mod)) )
  assert(mod > 0 && my::gcd(n, mod) == 1);
  n %= mod;
  if (n < 0) n += mod;
  ll a = mod, b = n, x = 1, y = 0;
  while (b != 0) {
    ll q = a / b, r = a % b;
    a = b;
    b = r;
    y -= q * x;
    swap(x, y);
  }
  y %= mod;
  if (y < 0) y += mod;
  return y;
}
ll modpow(ll a, ll n, ll mod) {  // O( log(n) )
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= a;
    ret %= mod;
    a *= a;
    a %= mod;
    n >>= 1;
  }
  return ret;
}
ll fastpow(ll a, ll n) {  // O( log(n) )
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= a;
    a *= a;
    n >>= 1;
  }
  return ret;
}

bool is_prime(ll n) {  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
vector<pair<ll, ll>> prime_factorize(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
vector<ll> divisors(ll n) {  // O( sqrt(n) )
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (n / i != i) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

/*union find*/
class unionfind {
 private:
  /*根のparの値は「-(その木の要素数)」とする*/
  ll n_;
  vector<ll> par;

 public:
  unionfind(ll n) : n_(n), par(n, -1) {}  // O(n)

  ll root(ll a) {  // O( log(n) )
    assert(0 <= a && a < n_);
    if (par.at(a) < 0)
      return a;
    else {
      par.at(a) = root(par.at(a));  //経路圧縮
      return par.at(a);
    }
  }

  void unite(ll a, ll b) {  // O( log(n) )
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    if (root(a) == root(b))
      return;
    else {
      ll ra = root(a), rb = root(b);
      if (-par.at(ra) < -par.at(rb)) swap(ra, rb);  //サイズによる併合
      par.at(ra) += par.at(rb);
      par.at(rb) = ra;
    }
  }

  bool is_same(ll a, ll b) {  // O( log(n) )
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    return root(a) == root(b);
  }

  ll size(ll a) {  // O( log(n) )
    assert(0 <= a && a < n_);
    return -par.at(root(a));
  }

  vector<vector<ll>> groups() {  // O(n)
    vector<vector<ll>> ret(n_);
    for (ll i = 0; i < n_; i++) {
      ret.at(root(i)).push_back(i);
    }
    ret.erase(remove_if(ret.begin(), ret.end(),
                        [](const vector<ll> &v) { return v.empty(); }),
              ret.end());
    return ret;
  }
};
}  // namespace my
////////////////////////////////////////////////

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &ai : a) cin >> ai;

  sort(a.begin(), a.end());
  int ans = a.front();
  int cntans = 0;
  for (int i = 2; i <= a.back(); i++) {
    int cnt = 0;
    for (auto &aj : a) {
      if (aj % i == 0) cnt++;
    }
    if (cnt > cntans) {
      ans = i;
      cntans = cnt;
    }
  }

  cout << ans << endl;
}