#include <bits/stdc++.h>
namespace CE_WA_TLE = std;
template <class T>
T readll(void) {
  T x = 0, w = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; (c - '-') || (w = -w), c = 1, c = getchar())
    ;
  for (; !(c < '0' || c > '9');
       (x = (x << 1) + (x << 3) + (c ^ 48)), c = 1, c = getchar())
    ;
  return x * w;
}
long long top;
namespace random_number {
unsigned long long seed1, seed2;
void srandnum(unsigned long long c, unsigned long long b) {
  seed1 = c + b;
  seed2 = b * c % 100000000007;
}
unsigned long long randnum() {
  seed1 ^= seed2 << 13;
  seed2 ^= seed1 >> 10;
  seed1 ^= seed2 << 5;
  seed2 ^= seed1 << 13;
  seed2 ^= seed1 << 5;
  seed1 = ~seed1;
  seed2 = ~seed2;
  seed1 ^= seed2 ^= seed1 ^= seed2;
  return seed1;
}
}  // namespace random_number
using namespace random_number;
long long gcd(long long a, long long b) {
  if (b)
    while (b ^= a ^= b ^= a %= b)
      ;
  return a;
}
long long a[1111111], b[1111111], c[1111111];
namespace cwt {
long long n, ans = 0;
inline void works(long long u) {
  long long top = 1;
  for (long long i = 1; i <= n; i++) {
    b[i] = gcd(a[u], a[i]);
    c[i] = 0;
  }
  CE_WA_TLE::sort(b + 1, b + n + 1);
  for (long long i = 1; i <= n; i++) {
    if (b[i] - b[top]) b[++top] = b[i];
    c[top]++;
  }
  long long max = 1;
  for (long long i = 1; i <= top; i++) {
    long long sum = 0;
    for (long long j = i; j <= top; j++) {
      if (!(b[j] % b[i])) sum += c[j];
    }
    if (sum >= ((n + 1) >> 1)) max = b[i];
  }
  if (ans < max) ans = max;
}
inline void work(void) {
  n = readll<long long>(), ans = 1;
  srandnum(time(0) + n * n / 2 + 13 * n + 273, time(0) + (n << 4) + n - 233);
  srandnum(randnum() * 7 - 2, randnum() * 5 + 21);
  for (long long i = 1; i <= n; i++) {
    a[i] = readll<long long>();
  }
  srandnum(randnum() * 7 + a[1] + a[(n + 1) / 2],
           randnum() * 5 + a[n] + a[(n + 1) / 2]);
  for (long long cs = 0; cs <= 11; cs++)
    works((randnum() + 23 + randnum()) % n + 1);
  printf("%I64d\n", ans);
}
}  // namespace cwt
signed main() {
  cwt::work();
  return 0;
}
