#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

template <class Monoid, class Function>
class SegmentTree {
 public:
  SegmentTree(const std::vector<Monoid>& data, Monoid identity_element,
              Function function)
      : identity_element_(identity_element), data_(data), function_(function) {
    build();
  }

  void update(int pos, Monoid new_value) {
    assert(0 <= pos && pos < n_);
    pos += n_;
    node_[pos] = new_value;
    while (pos > 0) {
      pos >>= 1;
      node_[pos] = function_(node_[2 * pos], node_[2 * pos + 1]);
    }
  }

  // return function_[l, r)
  Monoid query(int l, int r) {
    assert(0 <= l && l < n_ && 0 <= r - 1 && r - 1 < n_);
    Monoid vl = identity_element_, vr = identity_element_;
    for (l += n_, r += n_; l < r; l >>= 1, r >>= 1) {
      if (l & 1) vl = function_(vl, node_[l++]);
      if (r & 1) vr = function_(node_[--r], vr);
    }
    return function_(vl, vr);
  }

  Monoid operator[](int pos) const {
    assert(0 <= pos && pos < n_);
    return node_[n_ + pos];
  }

 private:
  int n_;
  Monoid identity_element_;
  std::vector<Monoid> data_;
  std::vector<Monoid> node_;
  Function function_;

  void build() {
    int SIZE = data_.size();
    n_ = 1;
    while (n_ < SIZE) {
      n_ <<= 1;
    }
    node_.assign(2 * n_, identity_element_);
    for (int i = 0; i < SIZE; ++i) {
      node_[i + n_] = data_[i];
    }
    for (int i = n_ - 1; i > 0; --i) {
      node_[i] = function_(node_[2 * i], node_[2 * i + 1]);
    }
  }
};

int main() {
  int N;
  cin >> N;
  vector<int64> A(N);
  cin >> A;
  auto f = [](int64 x, int64 y) { return __gcd(x, y); };
  SegmentTree<int64, decltype(f)> seg(A, 0, f);
  int64 ans = 1;
  for (int i = 0; i < N; i++) {
    seg.update(i, 0);
    int64 tmp = seg.query(0, N);
    if (tmp >= ans) {
      ans = tmp;
    }
    seg.update(i, A[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3840