#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long sol, V, pula[1000100], x, dej[14], b[1000100], c[1000100], a[1000100];
int n, t, K, fr[1000100], r, pick;
int main() {
  srand(time(0));
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    b[i] = a[i];
  }
  r = n;
  sol = 1;
  for (int kkt = 1; kkt <= 6; ++kkt) {
    t = 0;
    K = 0;
    if (!r) break;
    int p = rand() % r + 1;
    x = b[p];
    V = b[p];
    int oldr = r;
    r = 0;
    for (int i = 1; i <= oldr; ++i)
      if (b[i] != x) c[++r] = b[i];
    for (int i = 1; i <= r; ++i) b[i] = c[i];
    int lim = 1 << 20;
    for (int i = 1; i <= lim; ++i) {
      if (1LL * i * i > x) break;
      if (x % i == 0) {
        pula[++t] = x / i;
        pula[++t] = i;
      }
    }
    if ((long long)sqrt(x) * (long long)sqrt(x) == x) --t;
    for (int i = 1; i <= t; ++i) fr[i] = 0;
    sort(pula + 1, pula + t + 1);
    for (int i = 1; i <= n; ++i) {
      x = gcd(V, a[i]);
      int st = 1;
      int dr = t;
      while (st <= dr) {
        int mij = (st + dr) >> 1;
        if (pula[mij] == x) {
          ++fr[mij];
          break;
        } else if (pula[mij] > x)
          dr = mij - 1;
        else
          st = mij + 1;
      }
    }
    for (int i = 1; i <= t; ++i)
      for (int j = i + 1; j <= t; ++j) {
        if (pula[j] % pula[i] == 0) fr[i] += fr[j];
      }
    for (int i = t; i >= 1; --i)
      if (fr[i] * 2 >= n) {
        if (pula[i] > sol) sol = pula[i];
        break;
      }
  }
  cout << sol;
  return 0;
}
