#include <bits/stdc++.h>

using namespace std;

#define IOS             ios::sync_with_stdio(false); cin.tie(0);

void solve()
{
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    int max_gcd = 1;
    int max_count = 0;
    for (int gcd = 1000; gcd > 1; --gcd) {
        int count = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] % gcd == 0) ++count;
        }
        if (max_count < count) {
            max_count = count;
            max_gcd = gcd;
        }
    }
    cout << max_gcd << "\n";
}

int main()
{
    IOS;
    solve();
    return 0;
}

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

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

signed main(void)
{
	int n;
	int ans, out, tmp, g, g_tmp;

	cin >> n;
	vector<int> a(n);
	rep(i, n) cin>>a[i];
	sort(a.begin(), a.end());
	ans = 0;
	out = 1;
	for (int i = 0; i < n - 1; i++)
	{
		tmp = 1;
		g = a[i];
		for (int j = i + 1; j < n; j++)
		{
			g_tmp = gcd(g, a[j]);
			if (g_tmp == 1)
				continue;
			g = g_tmp;
			tmp++;
		}	
		if (tmp > ans)
		{
			out = g;
			ans = tmp;
		}
	}
	cout << (out == 1 ? a[0] : out )<< endl;
	return 0;
}
