#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n,a[100000];

lin gcm(lin x, lin y)
{
    if(x < y)
        return gcm(y, x);

    lin r = x % y;
    if(r == 0)
        return y;

    return gcm(y, r);
}

pair<unordered_set<lin>, unordered_set<lin>> solve(int bg, int ed)
{
    if(bg == ed)
    {
        unordered_set<lin> used;
        unordered_set<lin> unused;
        unused.emplace(a[bg]);

        return make_pair(used, unused);
    }

    if(bg - ed == 1)
    {
        unordered_set<lin> used;
        unordered_set<lin> unused;
        used.emplace(a[bg]);
        if(a[bg] != a[ed])
            used.emplace(a[ed]);
        unused.emplace(gcm(a[bg], a[ed]));

        return make_pair(used, unused);
    }

    {
        unordered_set<lin> used;
        unordered_set<lin> unused;

        int mid = (bg + ed) / 2;
        auto res1 = solve(bg, mid);
        auto res2 = solve(mid + 1, ed);


        if(res1.second.size() == 0)
            unused = res2.second;
        else if(res2.second.size() == 0)
            unused = res1.second;
        else
        {
            for(auto itr1 = res1.second.begin(); itr1 != res1.second.end(); itr1++)
            {
                for(auto itr2 = res2.second.begin(); itr2 != res2.second.end(); itr2++)
                {
                    auto g = gcm(*itr1, *itr2);
                    if(unused.find(g) == unused.end())
                        unused.emplace(g);
                }
            }
        }

        if(res1.first.size() == 0)
        {
            for(auto itr2 = res2.second.begin(); itr2 != res2.second.end(); itr2++)
            {
                if(used.find(*itr2) == used.end())
                    used.emplace(*itr2);
            }
        }
        else if(res2.second.size() == 0)
        {
            for(auto itr1 = res1.first.begin(); itr1 != res1.first.end(); itr1++)
            {
                if(used.find(*itr1) == used.end())
                    used.emplace(*itr1);
            }
        }
        else
        {
            for(auto itr1 = res1.first.begin(); itr1 != res1.first.end(); itr1++)
            {
                for(auto itr2 = res2.second.begin(); itr2 != res2.second.end(); itr2++)
                {
                    auto g = gcm(*itr1, *itr2);
                    if(used.find(g) == used.end())
                        used.emplace(g);
                }
            }
        }

        if(res2.first.size() == 0)
        {
            for(auto itr2 = res1.second.begin(); itr2 != res1.second.end(); itr2++)
            {
                if(used.find(*itr2) == used.end())
                    used.emplace(*itr2);
            }
        }
        else if(res1.second.size() == 0)
        {
            for(auto itr1 = res2.first.begin(); itr1 != res2.first.end(); itr1++)
            {
                if(used.find(*itr1) == used.end())
                    used.emplace(*itr1);
            }
        }
        else
        {
            for(auto itr1 = res1.second.begin(); itr1 != res1.second.end(); itr1++)
            {
                for(auto itr2 = res2.first.begin(); itr2 != res2.first.end(); itr2++)
                {
                    auto g = gcm(*itr1, *itr2);
                    if(used.find(g) == used.end())
                        used.emplace(g);
                }
            }
        }

        return make_pair(used, unused);
    }
}

int main(void)
{
    cin >> n;
    rep(i,n)
    {
        cin >> a[i];
    }

    auto r = solve(0, n - 1);
    lin res = 1;

    for(auto itr1 = r.first.begin(); itr1 != r.first.end(); itr1++)
    {
        //cout << *itr1 << endl;
        res = max(*itr1, res);
    }

    for(auto itr2 = r.second.begin(); itr2 != r.second.end(); itr2++)
    {
        //cout << *itr2 << endl;
        res = max(*itr2, res);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024