#include <bits/stdc++.h>
using namespace std;
inline void readll(long long &x);
const int maxn = 1100000;
int n, seed;
long long a[maxn], ans;
int c[maxn];
long long gcd(const long long &a, const long long &b) {
  return b ? gcd(b, a % b) : a;
}
void init() {
  long long tn;
  readll(tn);
  n = tn;
  for (int i = 1; i <= n; i++) readll(a[i]);
  random_shuffle(a + 1, a + n + 1);
}
void work() {
  long long X = a[rand() % n + 1], G;
  vector<long long> D;
  for (long long i = 1; i * i <= X; i++)
    if (X % i == 0) {
      D.push_back(i);
      if (i * i != X) D.push_back(X / i);
    }
  sort(D.begin(), D.end());
  memset(c, 0, int(D.size()) << 2);
  for (int i = 1; i <= n; i++) {
    G = gcd(a[i], X);
    c[lower_bound(D.begin(), D.end(), G) - D.begin()]++;
  }
  for (int i = 0; i < D.size(); i++) {
    for (int j = i + 1; j < D.size(); j++)
      if (D[j] % D[i] == 0) c[i] += c[j];
    if (c[i] * 2 >= n) ans = max(ans, D[i]);
  }
}
int main() {
  init();
  for (int T = 0; T < 8; T++) work();
  printf("%I64d\n", ans);
  return 0;
}
inline void readll(long long &x) {
  char c;
  for (c = getchar(); c > '9' || c < '0'; c = getchar())
    ;
  x = c ^ '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar())
    x = x * 10 + (c ^ '0');
}
