// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



vector<int> Divis(int n) {

	vector<int> divs;

	

	for (int i = 2; i * i <= n; i++) {

		if (n % i == 0) divs.push_back(i);

	}

	

	for (int i = divs.size() - 1; i >= 0 ; i--) {

		if (n / divs[i] != divs[i]) divs.push_back(n / divs[i]);

	}

	

	divs.push_back(n);

	

	return divs;

}



int main() {

	int n; cin >> n;

	vector<int> a(n);

	for (int i = 0; i < n; i++) cin >> a[i];

	

	vector<vector<int> > divs(n);

	for (int i = 0; i < min(2,n); i++) divs[i] = Divis(a[i]);

	

	set<int> mults;

	map<int, int> mp;

	

	for (int i = 0; i < min(n,2); i++) {

		for (int j = 0; j < divs[i].size(); j++) {

			mults.insert(divs[i][j]);

		}

	}

	

	int gcd = 0, close = 0;

	

	for (auto i = mults.begin(); i != mults.end(); i++) {

	    int cnt = 0;

	    for(int j = 0; j < n; j++){

	        if(a[j] % (*i) == 0) cnt += 1;

	    }

		if (cnt == n) gcd = (*i);

		if (cnt == n - 1) close = (*i);

	}

	

	if (gcd != 0 || close != 0) {

		if (gcd > close) cout << gcd;

		else cout << close;

	}

	else cout << 1;

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3978356860425734x):
//bad_bat

#include<bits/stdc++.h>

using namespace std;



#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define FO             freopen("in.txt", "r", stdin)

#define FC             freopen("out.txt", "w", stdout)

#define aise           cout<<"aise"<<endl

#define pb             push_back

#define pf             push_front

#define ppb            pop_back

#define ppf            pop_front

#define mp             make_pair

#define ll             long long

#define all(x)         x.begin(), x.end()

#define mset(v, a)     memset(v, a, sizeof(v))

#define pll            pair< ll, ll >

#define pd             pair< double, double >

#define ff             first

#define ss             second

#define pi             acos(-1.0)

#define mxN            2010

#define inf            1e14

#define mod            1000000007

#define tc             ll tc;scanf("%lld",&tc);while(tc--)



//NCR iterative

/*voidcomb_table(intN)

{

    for(inti=0; i<=N; ++i)

    {

        for(intj=0; j<=i; ++j)

        {

            if(j==0or j==i)

            {

                C[i][j]=1LL;

            }

            else

            {

                C[i][j]=(C[i-1][j-1]+C[i-1][j]);

            }

        }

    }

}*/





//NCR recursive

/*ll dp[55][55];



ll NCR(ll n,ll r)

{



    if(n==r)

        return dp[n][r]=1;

    if(r==0)

        return dp[n][r]= 1;

    if(r==1)

        return dp[n][r]=n ;

    if(dp[n][r] != -1)

        return dp[n][r];

    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);

}*/



//Sieve:

/*bool Flag[1000010];

vector<ll> Prime;



void sieve()

{



    ll val=sqrt(1000010);

    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;

    for(ll i=3;i <= val;i+=2)

    {



        if(Flag[i]==0)

        {



            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;

        }

    }

    Flag[1]=1;

    for(ll i=1;i<=1000000;i++)

        if(Flag[i]==0) Prime.pb(i);

}*/





//Conversion

/*string bin(ll x)

{



    string ret;

    while(x)

    {



        ll t=x%2;

        char c;

        if(t==1)

            c='1';

        else

            c='0';

        ret.pb(c);

        x/=2;

    }

    reverse(all(ret));

    return ret;

}*/



/*ll lcm(ll x, ll y)

{



    ll ret=__gcd(x,y);

    return (x*y)/ret;

}*/



/*ll dx[]= {0,0,1,-1};

ll dy[]= {1,-1,0,0};*/



int main()

{

    ll n;

    cin >> n;

    vector< ll > v(n+2, 0), v1(n+2, 0), v2(n+2, 0);

    for(ll i = 1; i <= n; i++)

        cin >> v[i];

    for(ll i = 1; i <= n; i++)

    {



        v1[i] = __gcd(v1[i-1], v[i]);

    }

    for(ll i = n; i >= 1; i--)

    {



        v2[i] = __gcd(v2[i+1], v[i]);

    }

    ll ans = 0;

    for(ll i = 1; i<= n; i++)

    {



        ll x = v1[i-1], y = v2[i+1];

        ll z = __gcd(x, y);

        ans = max(ans, z);

    }

    cout << ans;

}