#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 5;
long long a[N], b[N];
int n, tot, cnt[N];
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
void init() {
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
}
void slove() {
  long long ret = 1;
  for (int step = 1; step <= 10; step++) {
    long long val = a[(rand() << 12 | rand()) % n];
    tot = 0;
    for (long long i = 1; i * i <= val; i++) {
      if (val % i == 0) {
        b[tot++] = i;
        if (i != val / i) b[tot++] = val / i;
      }
    }
    for (int i = 0; i < tot; i++) cnt[i] = 0;
    sort(b, b + tot);
    for (int i = 0; i < n; i++)
      cnt[lower_bound(b, b + tot, gcd(a[i], val)) - b]++;
    for (int i = tot - 1; i >= 0; i--) {
      if (b[i] < ret) break;
      int sum = 0;
      for (int j = i; j < tot; j++) {
        if (b[j] % b[i] == 0) sum += cnt[j];
      }
      if (sum * 2 >= n) ret = b[i];
    }
  }
  printf("%I64d\n", ret);
}
int main() {
  srand(time(NULL));
  while (scanf("%d", &n) != EOF) {
    init();
    slove();
  }
  return 0;
}
