#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 9;
long long n;
long long ans, a[MAXN], q[MAXN], c[MAXN], cnt[MAXN], tmp[MAXN];
inline long long random(long long x) { return ((rand() << 15) | rand()) % x; }
long long gcd(long long x, long long y) { return !y ? x : gcd(y, x % y); }
void solve() {
  long long u = a[random(n) + 1];
  long long tl = 0;
  for (long long i = 1; i <= n; ++i) {
    long long d = gcd(u, a[i]);
    q[++tl] = d;
  }
  sort(q + 1, q + tl + 1);
  long long tl2 = 0;
  for (long long i = 1; i <= sqrt(u); ++i) {
    if (!(u % i)) {
      c[++tl2] = i;
      if (i * i != u) tmp[tl2] = u / i;
    }
  }
  long long tmpt = tl2;
  if (!tmp[tmpt]) tmpt--;
  for (long long i = tmpt; i; --i) c[++tl2] = tmp[i], tmp[i] = 0;
  long long pre = 0;
  for (long long i = 1; i <= tl; ++i) {
    if (q[i] != q[i + 1] || i == tl) {
      long long t = lower_bound(c + 1, c + tl2 + 1, q[i]) - c;
      cnt[t] = i - pre;
      pre = i;
    }
  }
  for (long long i = 1; i <= tl2; ++i) {
    for (long long j = i + 1; j <= tl2; ++j)
      cnt[i] += (!(c[j] % c[i])) * cnt[j];
    if (cnt[i] >= (n + 1) / 2) ans = max(ans, c[i]);
  }
  for (long long i = 1; i <= tl2; ++i) cnt[i] = 0;
}
signed main() {
  scanf("%I64d", &n);
  for (long long i = 1; i <= n; ++i) scanf("%I64d", &a[i]);
  srand((unsigned)time(0));
  for (long long i = 1; i <= 10; ++i) solve();
  printf("%I64d\n", ans);
  return 0;
}
