#include <bits/stdc++.h>
using namespace std;
int n, num, nums[10005];
long long a[1000005], d[1000005];
void divide(long long v) {
  num = 0;
  for (long long i = 1; i * i <= v; i++) {
    if (v % i == 0) {
      d[++num] = i;
      if (v / i != i) d[++num] = v / i;
    }
  }
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  srand(time(NULL));
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  int t = 11;
  long long ans = 1;
  while (t--) {
    long long x = a[1ll * rand() * rand() % n + 1];
    divide(x);
    sort(d + 1, d + num + 1);
    memset(nums, 0, sizeof(nums));
    for (int i = 1; i <= n; i++) {
      int pos = lower_bound(d + 1, d + num + 1, gcd(x, a[i])) - d;
      nums[pos]++;
    }
    for (int i = 1; i <= num; i++)
      for (int j = i + 1; j <= num; j++)
        if (d[j] % d[i] == 0) nums[i] += nums[j];
    for (int i = num; i >= 1; i--) {
      if (nums[i] * 2 >= n) {
        ans = max(ans, d[i]);
        break;
      }
    }
  }
  printf("%lld\n", ans);
}
