/**
 *   author:  prakhar17252
 *   created: 27.04.2019 18:20:31
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
#define int ll

#define pb emplace_back
#define push emplace
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define len(a) (int) a.size()
#define reset(a, val) memset(a, val, sizeof(a))
#define endl '\n'
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;

const ll mod = (int) 1e9 + 7;
const ll inf = (ll) 2e18;
const ll ninf = (ll) -2e18;

ll power(ll x, ll y, ll mod = inf) {
    if (y == 0) return 1LL;
    if (y % 2) return ((x % mod) * power(x, y - 1, mod)) % mod;
    return power((x * x) % mod, y / 2, mod);
}

const int N = 1e5 + 10;
int segtree[4*N];
int a[N];
int n;

#define lc node + node
#define rc node + node + 1

inline int merge(int a, int b) {
    return __gcd(a, b);
}

void build(int node, int start, int end) {
    if(start == end) {
        segtree[node] = a[start];
        return;
    }

    int mid = (start + end) / 2;

    build(lc, start, mid);
    build(rc, mid+1, end);

    segtree[node] = merge(segtree[lc], segtree[rc]);
}

int query(int node, int start, int end, int l, int r) {
    if(start > r || end < l) return 0;
    if(l <= start && end <= r) return segtree[node];

    int mid = (start + end) / 2;

    return merge(query(lc, start, mid, l, r), query(rc, mid+1, end, l, r));
}

void build() { build(1, 1, n); }
int query(int l, int r) { return query(1, 1, n, l, r); }

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    time_t t1, t2;
    t1 = clock();

    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    //     freopen("error.txt", "w", stderr);
    // #endif

    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    build();

    int ans = 1;
    for (int i = 1; i <= n; i++) {
        ans = max(ans, merge(query(1, i-1), query(i+1, n)));
    }

    cout << ans << '\n';

    t2 = clock();
    #ifndef ONLINE_JUDGE
        cerr << endl << "time taken: " << (ld) (t2 - t1) / CLOCKS_PER_SEC << endl;
    #endif // ONLINE_JUDGE

    return 0;
}

Measured memory_bytes: 3072