#include <bits/stdc++.h>
using namespace std;
long long read() {
  register long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int Size = 1000005;
long long n, m, app[Size];
long long a[Size], divi[Size];
long long gcd(long long x, long long y) {
  if (!x) return y;
  return gcd(y % x, x);
}
int main() {
  srand(19260817);
  n = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  long long ans = 0;
  for (register int i = 1; i <= 10; i++) {
    memset(app, 0, sizeof(app));
    long long x = rand() * rand() % n + 1, cnt = 0;
    long long sx = sqrt(a[x]);
    for (long long j = 1; j <= sx; j++) {
      if (!(a[x] % j)) {
        divi[++cnt] = j;
        divi[++cnt] = a[x] / j;
      }
    }
    if (divi[cnt] == divi[cnt - 1]) cnt--;
    sort(divi + 1, divi + 1 + cnt);
    for (register int j = 1; j <= n; j++) {
      long long now = gcd(a[x], a[j]);
      int pos = lower_bound(divi + 1, divi + 1 + cnt, now) - divi;
      app[pos]++;
    }
    for (register int j = 1; j <= cnt; j++) {
      for (register int k = 1; k < j; k++) {
        if (!(divi[j] % divi[k])) {
          app[k] += app[j];
        }
      }
    }
    for (register int j = cnt; j; j--) {
      if ((app[j] << 1ll) >= n) {
        if (divi[j] > ans) ans = divi[j];
        break;
      }
    }
  }
  printf("%I64d", ans);
  return 0;
}
