#include <bits/stdc++.h>
using namespace std;
using namespace std;
const long long mod2 = 998244353;
long long fpow(long long x, long long y) {
  x = x % 1000000007;
  long long sum = 1;
  while (y) {
    if (y & 1) sum = sum * x;
    sum %= 1000000007;
    y = y >> 1;
    x = x * x;
    x %= 1000000007;
  }
  return sum;
}
long long inv(long long a, long long m = 1000000007) {
  long long c = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += c;
  return x;
}
long long gcd(long long a, long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long res = 1;
  for (int i = 0; i < 10; i++) {
    long long ele = a[rng() % n];
    vector<long long> div, cnt;
    for (long long j = 1; j * j <= ele; j++) {
      if ((ele % j) == 0) {
        if (j * j == ele) {
          div.push_back(j);
          cnt.push_back(0);
        } else {
          div.push_back(j);
          cnt.push_back(0);
          div.push_back(ele / j);
          cnt.push_back(0);
        }
      }
    }
    sort(div.begin(), div.end());
    for (int j = 0; j < n; j++) {
      long long g = gcd(ele, a[j]);
      cnt[lower_bound(div.begin(), div.end(), g) - div.begin()]++;
    }
    for (int j = 0; j < div.size(); j++) {
      for (int k = j + 1; k < div.size(); k++) {
        if (div[k] % div[j] == 0) cnt[j] += cnt[k];
      }
      if (2 * cnt[j] >= n) res = max(res, div[j]);
    }
  }
  cout << res << "\n";
}
