#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)

#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))

#define MAXN 1000005
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)

#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())

using namespace std;
#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) {
	while(L < R) cerr << *L << " \n"[next(L) == R],++L;
}
void kout() {cerr << endl;}
template<class T1, class ... T2> void kout(T1 a, T2 ... e) {
	cerr << a << " ", kout(e...); 
}
#else 
#define print(...) 0
#define vprint(...) 0
#endif
int n;
vector<int> a;
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	a.assign(n + 1, 0);
	rep(i, 1, n) cin >> a[i];
	int ans = -1, cnt = 0;
	rep(i, 2, 1000) {
		int cur = 0;
		rep(j, 1, n) 
			cur += bool(a[j] % i == 0);
		if(cur > cnt) ans = i, cnt = cur;
	}
	cout << ans << "\n";
	return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for(auto& a: v){
    cin >> a;
  }
  
  int ret = 0;
  int maxcount = 0;
  for(int i = 2; i <= 1000; ++i){
    int count = 0;
    for(auto& a : v){
      if(a % i == 0){
		++count;        
      }
    }
    if(maxcount < count){
      maxcount = count;
      ret = i;
    }
  }
  cout << ret << endl;
  return 0;
}