#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <bitset>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <cctype>
#include <fstream>
#include <numeric>
#include <cassert>


#include <algorithm>

#ifdef _MSC_VER
#include <intrin.h>
#endif

namespace atcoder {

namespace internal {

// @param n `0 <= n`
// @return minimum non-negative `x` s.t. `n <= 2**x`
int ceil_pow2(int n) {
    int x = 0;
    while ((1U << x) < (unsigned int)(n)) x++;
    return x;
}

// @param n `1 <= n`
// @return minimum non-negative `x` s.t. `(n & (1 << x)) != 0`
int bsf(unsigned int n) {
#ifdef _MSC_VER
    unsigned long index;
    _BitScanForward(&index, n);
    return index;
#else
    return __builtin_ctz(n);
#endif
}

}  // namespace internal

}  // namespace atcoder

#include <cassert>
#include <vector>

namespace atcoder {

template <class S, S (*op)(S, S), S (*e)()> struct segtree {
  public:
    segtree() : segtree(0) {}
    segtree(int n) : segtree(std::vector<S>(n, e())) {}
    segtree(const std::vector<S>& v) : _n(int(v.size())) {
        log = internal::ceil_pow2(_n);
        size = 1 << log;
        d = std::vector<S>(2 * size, e());
        for (int i = 0; i < _n; i++) d[size + i] = v[i];
        for (int i = size - 1; i >= 1; i--) {
            update(i);
        }
    }

    void set(int p, S x) {
        assert(0 <= p && p < _n);
        p += size;
        d[p] = x;
        for (int i = 1; i <= log; i++) update(p >> i);
    }

    S get(int p) {
        assert(0 <= p && p < _n);
        return d[p + size];
    }

    S prod(int l, int r) {
        assert(0 <= l && l <= r && r <= _n);
        S sml = e(), smr = e();
        l += size;
        r += size;

        while (l < r) {
            if (l & 1) sml = op(sml, d[l++]);
            if (r & 1) smr = op(d[--r], smr);
            l >>= 1;
            r >>= 1;
        }
        return op(sml, smr);
    }

    S all_prod() { return d[1]; }

    template <bool (*f)(S)> int max_right(int l) {
        return max_right(l, [](S x) { return f(x); });
    }
    template <class F> int max_right(int l, F f) {
        assert(0 <= l && l <= _n);
        assert(f(e()));
        if (l == _n) return _n;
        l += size;
        S sm = e();
        do {
            while (l % 2 == 0) l >>= 1;
            if (!f(op(sm, d[l]))) {
                while (l < size) {
                    l = (2 * l);
                    if (f(op(sm, d[l]))) {
                        sm = op(sm, d[l]);
                        l++;
                    }
                }
                return l - size;
            }
            sm = op(sm, d[l]);
            l++;
        } while ((l & -l) != l);
        return _n;
    }

    template <bool (*f)(S)> int min_left(int r) {
        return min_left(r, [](S x) { return f(x); });
    }
    template <class F> int min_left(int r, F f) {
        assert(0 <= r && r <= _n);
        assert(f(e()));
        if (r == 0) return 0;
        r += size;
        S sm = e();
        do {
            r--;
            while (r > 1 && (r % 2)) r >>= 1;
            if (!f(op(d[r], sm))) {
                while (r < size) {
                    r = (2 * r + 1);
                    if (f(op(d[r], sm))) {
                        sm = op(d[r], sm);
                        r--;
                    }
                }
                return r + 1 - size;
            }
            sm = op(d[r], sm);
        } while ((r & -r) != r);
        return 0;
    }

  private:
    int _n, size, log;
    std::vector<S> d;

    void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};

}  // namespace atcoder


#include <cstdint>
#include <iomanip>
#include <cstring>
using namespace std;
using namespace atcoder;
using ll = long long;
using LL = long long;
#define ALL(a) (a).begin(), (a).end()

#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)

const int MOD = 1000000007;

#define LLONG_MAXs 9223372036854775800 / 2
#define INF 9223372036854775800 / 2
//#define bit(n, k) ((n >> k) & 1) /*n縺ｮk bit逶ｮ*/
#define ALL(a) (a).begin(), (a).end()

#include <iostream>
#include <cmath>
using namespace std;

bool isPrimeNum(ll x)
{ // 邏�謨ｰ縺ｧ縺ゅｋ蝣ｴ蜷� true 繧定ｿ斐☆
    if (x <= 1)
    { // 1莉･荳九〒縺ゅｋ蝣ｴ蜷医��邏�謨ｰ縺ｧ縺ｪ縺��％縺ｨ縺後☆縺舌↓繧上°繧�
        return false;
    }
    // sqrt( double蝙� ) 縺ｯ蠑墓焚縺ｮ蟷ｳ譁ｹ譬ｹ繧� double蝙九〒霑斐☆縺ｮ縺ｧ縲（nt蝙九〒繧ｭ繝｣繧ｹ繝�
    int n = (int)sqrt((double)x);
    for (int i = 2; i <= n; i++)
    {
        if (x % i == 0)
        { // 蜑ｲ繧雁��繧区紛謨ｰ縺後≠繧句�ｴ蜷医�∝叉蛻､螳夂ｵゆｺ�
            return false;
        }
    }
    return true; // 蜑ｲ繧雁��繧区紛謨ｰ縺後↑縺���ｴ蜷医�∫ｴ�謨ｰ縺ｧ縺ゅｋ
}

ll myPow(ll x, ll n, ll m)
{
    if (n == 0)
        return 1;
    if (n % 2 == 0)
        return myPow(x * x % m, n / 2, m);
    else
        return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b)
{
    if (a >= b)
        return a - b;
    if (a < b)
        return b - a;
}
constexpr double dabs(double a, double b)
{
    if (a >= b)
        return a - b;
    if (a < b)
        return b - a;
}
constexpr ll min(ll a, ll b)
{
    if (a >= b)
        return b;
    if (a < b)
        return a;
}

constexpr ll max(ll a, ll b)
{
    if (a >= b)
        return a;
    if (a < b)
        return b;
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};

class UnionFind
{
public:
    //隕ｪ縺ｮ逡ｪ蜿ｷ繧呈�ｼ邏阪☆繧九�りｦｪ縺�縺｣縺溷�ｴ蜷医��-(縺昴��髮��粋縺ｮ繧ｵ繧､繧ｺ)
    vector<int> Parent;

    //菴懊ｋ縺ｨ縺阪��Parent縺ｮ蛟､繧貞��縺ｦ-1縺ｫ縺吶ｋ
    //縺薙≧縺吶ｋ縺ｨ蜈ｨ縺ｦ繝舌Λ繝舌Λ縺ｫ縺ｪ繧�
    UnionFind(int N)
    {
        Parent = vector<int>(N, -1);
    }

    //A縺後←縺ｮ繧ｰ繝ｫ繝ｼ繝励↓螻槭＠縺ｦ縺��ｋ縺玖ｪｿ縺ｹ繧�
    int root(int A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = root(Parent[A]);
    }

    //閾ｪ蛻����縺��ｋ繧ｰ繝ｫ繝ｼ繝励��鬆らせ謨ｰ繧定ｪｿ縺ｹ繧�
    int size(int A)
    {
        return -Parent[root(A)]; //隕ｪ繧偵→縺｣縺ｦ縺阪◆縺Ь
    }
    bool issame(int x, int y)
    {
        return root(x) == root(y);
    }
    //A縺ｨB繧偵￥縺｣莉倥￠繧�
    bool connect(int A, int B)
    {
        //A縺ｨB繧堤峩謗･縺､縺ｪ縺舌��縺ｧ縺ｯ縺ｪ縺上�〉oot(A)縺ｫroot(B)繧偵￥縺｣縺､縺代ｋ
        A = root(A);
        B = root(B);
        if (A == B)
        {
            //縺吶〒縺ｫ縺上▲縺､縺��※繧九°繧峨￥縺｣莉倥￠縺ｪ縺�
            return false;
        }

        //螟ｧ縺阪＞譁ｹ(A)縺ｫ蟆上＆縺��⊇縺�(B)繧偵￥縺｣莉倥￠縺溘＞
        //螟ｧ蟆上′騾��□縺｣縺溘ｉ縺ｲ縺｣縺上ｊ霑斐＠縺｡繧��≧縲�
        if (size(A) < size(B))
            swap(A, B);

        //A縺ｮ繧ｵ繧､繧ｺ繧呈峩譁ｰ縺吶ｋ
        Parent[A] += Parent[B];
        //B縺ｮ隕ｪ繧但縺ｫ螟画峩縺吶ｋ
        Parent[B] = A;

        return true;
    }
};

long long fac[510000], finv[510000], inv[510000];

// 繝����繝悶Ν繧剃ｽ懊ｋ蜑榊��逅�
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 莠碁���ｿよ焚險育ｮ�
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

void yn(bool flag)
{
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return;
}
void YN(bool flag)
{
    if (flag)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return;
}

std::vector<ll> enum_div(ll n) //n縺ｮ邏��焚繧貞��謖�
{
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i != 1 && i * i != n)
            {
                ret.push_back(n / i);
            }
        }
    }
    ret.push_back(n);
    return ret;
}

// modint: mod 險育ｮ励ｒ int 繧呈桶縺��ｈ縺��↓謇ｱ縺医ｋ讒矩��菴�
template <int MOD>
struct Fp
{
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp &operator+=(const Fp &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp &operator-=(const Fp &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator*=(const Fp &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp &operator/=(const Fp &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr bool operator==(const Fp &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
    {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept
    {
        if (n == 0)
            return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1)
            t = t * a;
        return t;
    }
};

//using mint = Fp<MOD>;

// 繧ｰ繝ｩ繝輔そ繝��ヨ
struct Edge
{
    ll to;     // 霎ｺ縺ｮ陦後″蜈�
    ll weight; // 霎ｺ縺ｮ驥阪∩
    Edge(int t, int w) : to(t), weight(w) {}
};

typedef vector<vector<long long>> matrix;
matrix mul_mod(matrix A, matrix B)
{
    int H = A.size();
    int W = B[0].size();
    int K = A[0].size();

    matrix C(H, vector<ll>(W, 0));
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            for (int k = 0; k < K; k++)
            {
                C[i][j] += A[i][k] * B[k][j];
                C[i][j] %= MOD;
            }
        }
    }
    return C;
}

// 蛹ｺ髢灘刈邂励↓繧ょｯｾ蠢懊＠縺� BIT
template <class Abel>
struct BIT
{
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0; // to be set

    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n)
    {
        for (int iter = 0; iter < 2; ++iter)
            dat[iter].assign(n + 1, UNITY_SUM);
    }

    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x)
    {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x)
    {
        sub_add(0, a, x * -(a - 1));
        sub_add(1, a, x);
        sub_add(0, b, x * (b - 1));
        sub_add(1, b, x * (-1));
    }

    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a)
    {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b)
    {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }

    /* debug */
    void print()
    {
        for (int i = 1; i < (int)dat[0].size(); ++i)
            cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};
//cout << std::setprecision(30) << ans << endl;

using Graph = vector<vector<ll>>;

void print(const std::vector<int> &v)
{
    std::for_each(v.begin(), v.end(), [](int x) {
        std::cout << x << " ";
    });
    std::cout << std::endl;
}
const double PI = 3.14159265358979323846;
ll times_cap(ll a, ll b)
{
    if (log10(a) + log10(b) >= 19.0)
        return -1;
    else
        return a * b;
}
//cout<<std::setprecision(30)

int op(int a, int b) { return gcd(a, b); }

int e() { return 0; }

int target;

bool f(int v) { return v < target; }

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll ans = 0;
    segtree<int, op, e> seg(a);

    for (int i = 0; i < n; i++)
    {
        ll kari1 = seg.prod(0, i);
        ll kari2 = seg.prod(i + 1, n);
        //cout << kari1 << " " << kari2 << endl;
        ans = max(ans, gcd(kari1, kari2));
    }
    cout << ans << endl;
}


Measured memory_bytes: 4700