#include <bits/stdc++.h>

using namespace std;

int main(){
	int n; cin >> n;
	vector <int> a(n), pref(n), suff(n+1);
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	pref[0] = a[0];
	suff[n-1] = a[n-1];
	for(int i = 1;i < n;i++){
		pref[i] = __gcd(a[i], pref[i-1]);
	}
	suff[n] = a[n-1];
	for(int i = n - 1;i >= 0;i--){
		suff[i] = __gcd(a[i], suff[i+1]);
	}
	int Max = -1;
	for(int i = 0;i < n;i++){
		Max = max(Max, __gcd(pref[i-1], suff[i+1]));
	}
	cout << Max;
	return 0;
}

