// C - GCD on Blackboard
#include <bits/stdc++.h>
using namespace std;

int gcd(int a, int b){return b? gcd(b, a%b): a;}

int main(){
	int N; cin>>N;
	vector<int> A(N), L(N), R(N);

	for(int n=0; n<N; ++n) cin>>A[n];

	for(int l=0; l<=N-2; ++l){
		int r = N - l - 2;
		L[l+1] = gcd(L[l], A[l]);
		R[r] = gcd(R[r+1], A[r+1]);
	}

	int maxi = 0;
	for(int n=0; n<N; ++n) maxi = max(maxi, gcd(L[n], R[n]));
	cout<< maxi <<endl;
}