#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000,100000000000")
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
int n;
long long a[1000005];
long long d[1000005], sz;
long long cnt[1000005];
long long res = 1;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
void up(long long x) {
  sz = 0;
  for (long long i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      d[sz++] = i;
      if (i * i != x) {
        d[sz++] = x / i;
      }
    }
  }
  sort(d, d + sz);
  for (long long(i) = 0; (i) < (long long)(sz); (i)++) {
    cnt[i] = 0;
  }
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    long long cur = gcd(x, a[i]);
    int num = lower_bound(d, d + sz, cur) - d;
    ++cnt[num];
  }
  for (long long(i) = 0; (i) < (long long)(sz); (i)++) {
    for (int j = i + 1; j < sz; ++j) {
      if (d[j] % d[i] == 0) {
        cnt[i] += cnt[j];
      }
    }
    if (cnt[i] + cnt[i] >= n && res < d[i]) {
      res = d[i];
    }
  }
}
int main(void) {
  srand(time(NULL));
  scanf("%d", &n);
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    scanf("%I64d", a + i);
  }
  for (long long(i) = 0; (i) < (long long)(10); (i)++) {
    up(a[(rand() << 16 | rand()) % n]);
  }
  cout << res << endl;
  return 0;
}
