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

using namespace std;

int main()

{

    int t,a,p,c=0;

    vector<int>v,v1;

    cin>>t;

    for(int i=1; i<=t; i++)

    {

        cin>>a;

        v.push_back(a);

    }

    sort(v.begin(),v.end());

    p=sqrt(v[0]);

    for(int i=p; i>=1; i--)

    {

        if(v[0]%i==0)

        {

            v1.push_back(i);

            v1.push_back(v[0]/i);

        }

    }

    p=sqrt(v[t-1]);

    for(int i=p; i>=1; i--)

    {

        if(v[t-1]%i==0)

        {

            v1.push_back(i);

            v1.push_back(v[t-1]/i);

        }

    }

    sort(v1.begin(),v1.end());

    reverse(v1.begin(),v1.end());

    for(int i=0; i<v1.size(); i++)

    {

        c=0;

        for(int j=0; j<t; j++)

        {

            if(v[j]%v1[i]!=0)

            {

                c++;

                if(c==2)

                    break;

            }

        }

        if(c==1 || c==0)

        {

            cout<<v1[i]<<endl;

            break;

        }

    }

}


// Faster C++ solution for the same problem (measured speedup: 1.3118655934055494x):
///*****************************************************///

///*.......................Faiyaj Bin Amin............................*///

///*...................................................................*///

///*.........................KUET CSE 2K17......................*///

///*...................................................*///

///*****************************************************///



#include<bits/stdc++.h>

//#include <ext/pb_ds/assoc_container.hpp>

//#include <ext/pb_ds/tree_policy.hpp>



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

#define ret return

#define rep(q, i, n) for(int q=i; q<n; q++)

#define forn(i, n) for(int i=0; i<n; i++)

#define mems(a,x) memset(a,x,sizeof(a))

#define ll long long

#define pb push_back

#define em emplace_back

#define mp make_pair

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

#define ff first

#define ss second

#define pii pair<int,int>

#define pdd pair<double, double>



#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';

#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";



#define PI 2*acos(0.0)

#define lcm(a, b)  ((a / __gcd(a, b) ) * b)



#define filein freopen ("input.txt", "r", stdin)

#define fileout freopen ("output.txt", "w", stdout)



#define mx 100005

#define INF 1e18

#define MOD 1000000007

#define MIN 0



//template <typename T>  using orderedSet =

//    tree<T, null_type, less_equal<T>,

//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key





/*------------------------------Graph Moves----------------------------*/

//const int fx[]={+1,-1,+0,+0}; // Directional

//const int fy[]={+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/



/**------------------------------------BITMASK------------------------------------------**/

//int Change(int N, int pos){return N= N^(1<<pos);}

//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1

/**-----------------------------------------------------------------------------------------------**/



//using namespace __gnu_pbds;

using namespace std;



int main()

{

    fastio;



    int n;

    cin>>n;



    int a[n], g[n], r[n];

    forn(i, n)

    {

        cin >> a[i];

    }

    sort(a, a+n);



    g[0]=a[0];

    r[n-1]=a[n-1];

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

    {

        g[i] = __gcd(g[i-1], a[i]);

    }



    for(int i=n-2; i>=0; i--)

    {

        r[i] = __gcd(r[i+1], a[i]);

    }



    int maxi=g[n-1];

    if(n>1)

    {

        maxi = max(maxi, r[1]);

        maxi = max(maxi, g[n-2]);

    }

    for(int i=1; i<n-1; i++)

    {

        if(a[i]!=a[i+1])

        {

            maxi = max(maxi, __gcd(g[i-1], r[i+1]));

        }

    }



////    seecontent(a);

////    seecontent(g);

////    seecontent(r);



    cout << maxi << "\n";



    return 0;

}