#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
int n, t;
long long int a[N];
long long int divi[500004];
int dp[500004];
int tmp[500004];
long long int gcd(long long int a, long long int b) {
  return (b == 0 ? a : gcd(b, a % b));
}
long long int ans = 0;
int mk;
inline void check(int b) {
  mk = 0;
  memset(dp, 0, sizeof(dp));
  memset(tmp, 0, sizeof(tmp));
  for (long long int i = 1; i * i <= a[b]; ++i) {
    if (a[b] % i == 0) {
      mk++;
      divi[mk] = i;
      if (i * i != a[b]) {
        mk++;
        divi[mk] = a[b] / i;
      }
    }
  }
  sort(divi + 1, divi + mk + 1);
  long long int f = a[b];
  int d;
  for (int i = 1; i <= n; ++i) {
    f = gcd(a[i], a[b]);
    d = lower_bound(divi + 1, divi + mk + 1, f) - divi;
    tmp[d]++;
  }
  for (int i = 1; i <= mk; ++i) {
    for (int j = i; j <= mk; ++j)
      if (divi[j] % divi[i] == 0) dp[i] += tmp[j];
  }
  for (int i = 1; i <= mk; ++i) {
    if (dp[i] >= (n + 1) / 2) ans = max(ans, divi[i]);
  }
}
int main() {
  srand(time(NULL));
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%I64d", &a[i]);
  t = min(8, n);
  random_shuffle(a + 1, a + n + 1);
  random_shuffle(a + 1, a + n + 1);
  random_shuffle(a + 1, a + n + 1);
  for (int i = 1; i <= t; i++) check(i);
  cout << ans;
  return 0;
}
