#include <bits/stdc++.h>

using namespace std;

int gcd(int a, int b) {
	for (; b; swap(a, b))
		a %= b;
	return a;
}
int a[111111], b[111111];
int main() {
	int n, m = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", a + i);
		b[i + 1] = gcd(b[i], a[i]);
	}
	for (int i = n; i--;)
		a[i] = gcd(a[i], a[i + 1]);
	for (int i = 0; i < n; i++)
		m = max(m, gcd(a[i + 1], b[i]));
	cout << m << endl;
	return 0;
}
