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

double eps = 1e-9;
double pi = acos(-1);

int fx[8] = {1, -1, 0, 0, 1, -1, -1, 1};
int fy[8] = {0, 0, 1, -1, 1, -1, 1, -1};

#define fast_io ios_base::sync_with_stdio(false); cin.tie(0);
#define ll long long
#define en "\n"
#define ff first
#define ss second
#define sp(x) fixed << setprecision(x)
#define VECT(v)  vector<int>v
#define SCAN(v)  int temp; for(int i=0; i<n; i++) {cin>>temp; v.push_back(temp);}
#define PRINT(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout << en;
#define SORT(v)  sort(v.begin(), v.end());
#define RSORT(v) sort(v.begin(), v.end(), greater<>())
#define CASEP(v) cout<<"Case "<<tc<<": "<<v<<"\n"
#define DEBUG(v) cout << v << " "; cout << en;
#define mem(a, b) memset(a, b, sizeof(a))
#define valid(nx, ny, row, col) nx >= 0 && nx < row && ny >= 0 && ny < col

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	else
		return gcd(b, a % b);	
}

int main(void)
{
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	fast_io

	int n, val, mx = 0;
	cin >> n;

	VECT(v);
	
	for(int i = 0; i < n; i++)
	{
		cin >> val;
		v.push_back(val);
		mx = max(mx, val);
	}

	ll ans;
	ll num = 0;
	for(int i = 2; i <= mx; i++)
	{
		int cnt = 0;
		for(int j = 0; j < n; j++)
		{
			if(v[j] % i == 0)
			{
				cnt++;
			}
		}

		if(cnt > num)
		{
			num = cnt;
			ans = i;
		}
	}
	cout << ans << en;

	return 0;
}
#include <bits/stdc++.h>
using namespace std;
int N, c, r, i{2}, m;
int main()
  {cin >> N; int A[N]; for (int &a: A) cin >> a;
  for (; c = 0, i <= 1000; m = c > m ? r = i, c : m, ++i) for (int a : A) c += !(a % i);
  cout << r;}