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

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

#define LEN(x) (int)x.size()

#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)

using namespace std;

typedef int64_t i64;

typedef pair<int,int> pii;

template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}

template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;



void storeDivisor(vector<int> &dst, int n)

{

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

    if (n % i == 0) {

      dst.push_back(i);

      dst.push_back(n / i);

    }

  }

  return;

}



signed main()

{

  int N;

  int a[100010];



  cin >> N;

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



  vector<int> divisors;

  storeDivisor(divisors, a[0]);

  storeDivisor(divisors, a[1]);

  sort(ALL(divisors));

  divisors.erase(unique(ALL(divisors)), divisors.end());





  i64 ans = 1;



  for (int d : divisors) {

    const int cnt = count_if(a, a+N, [d](int a){ return a % d == 0; });

    if (cnt >= N-1) chmax(ans, d);

  }



  cout << ans << endl;



  return 0;

}




// Faster C++ solution for the same problem (measured speedup: 1.3621753721052319x):
#include "bits/stdc++.h"

// Begin Header {{{

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

#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)

#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)

#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)

#ifndef DBG

#define trace(...)

#endif

using namespace std;

using i64 = int_fast64_t;

using pii = pair<i64, i64>;

template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }

template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }

constexpr int INF  = 0x3f3f3f3f;

constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;



template <class T>

inline vector<T> make_v(const T &initValue, size_t sz) {

    return vector<T>(sz, initValue);

}



template <class T, class... Args>

inline auto make_v(const T &initValue, size_t sz, Args... args) {

    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));

}



inline void read() {}



template <class Head, class... Tail>

inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }



inline void print() { cout << "\n"; }



template <class Head, class... Tail>

inline void print(Head &&head, Tail&&... tail) {

    cout << head;

    if (sizeof...(tail)) cout << ' ';

    print(forward<Tail>(tail)...);

}



template <class T>

inline ostream& operator<< (ostream &out, const vector<T> &vec) {

    static constexpr const char *delim[] = { " ", "" };

    for (const auto &e : vec) out << e << delim[&e == &vec.back()];

    return out;

}

// }}} End Header



signed main()

{

    ios_base::sync_with_stdio(false); cin.tie(nullptr);



    int N; cin >> N;

    vector<int> a(N);



    rep(i, N) cin >> a[i];



    vector<int> foldL(N), foldR(N);

    foldL[0] = a[0];

    foldR[N-1] = a[N-1];



    reps(i, 1, N-1) foldL[i] = __gcd(a[i], foldL[i-1]);

    repr(i, N-2, 0) foldR[i] = __gcd(a[i], foldR[i+1]);



    trace(foldL);

    trace(foldR);



    int ans = 1;

    chmax(ans, foldL[N-2]);

    chmax(ans, foldR[1]);



    reps(i, 1, N-2) chmax(ans, __gcd(foldL[i-1], foldR[i+1]));



    print(ans);



    return 0;

}