#include<iostream>
using namespace std;
int a[100005],b[100005],c[100005];
int gcd(int a,int b){
	if(a<b) swap(a,b);
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}
int main()
{
	int n,i;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	
	b[1]=a[1];
	for(i=2;i<=n;i++)
		b[i]=gcd(b[i-1],a[i]);
	
	c[n]=a[n];
	for(i=n-1;i>=1;i--)
		c[i]=gcd(c[i+1],a[i]);
	
	int maxv=0;
	for(i=1;i<=n;i++)
		maxv=max(maxv,gcd(b[i-1],c[i+1]));
	cout<<maxv;
	return 0;
}