#include <bits/stdc++.h>
using namespace std;
bool sortBySecond(const pair<long long, long long> &a,
                  const pair<long long, long long> b) {
  return a.second > b.second;
}
int ncr[1001][1001];
bool vis_ncr[1001][1001];
long long NCR(int n, int r) {
  if (n < r) return 0;
  if (vis_ncr[n][r]) return ncr[n][r];
  if (r == 0) return 1;
  if (r == 1) return n;
  if (n == 0) return 0;
  ncr[n][r] = NCR(n - 1, r) + NCR(n - 1, r - 1);
  vis_ncr[n][r] = true;
  return ncr[n][r];
}
template <typename K, typename V>
void printMapMultipleValue(map<K, V> const &mp, string name) {
  cout << name << ":\n";
  for (auto const &pa : mp) {
    cout << pa.first << " : ";
    cout << "{";
    for (auto const &x : pa.second) cout << x << ',';
    cout << "}\n";
  }
}
template <typename K, typename V>
void printMap(map<K, V> const &mp, string name) {
  cout << name << ":" << endl;
  for (auto const &pa : mp)
    cout << "{" << pa.first << " : " << pa.second << "}" << endl;
}
bool isPrime[200006];
void _seive() {
  memset(isPrime, true, sizeof(isPrime));
  isPrime[1] = false;
  isPrime[0] = false;
  for (int i = 2; i * i <= 200005; i++) {
    for (int j = i * i; j <= 200005; j += i) {
      isPrime[j] = false;
    }
  }
}
long long expo(int a, int b) {
  if (b == 0)
    return 1;
  else if (b == 1)
    return a;
  else if (b % 2 == 0) {
    long long ret = expo(a, b / 2);
    ret = (ret % 1000000007 * ret % 1000000007) % 1000000007;
    return ret;
  } else {
    long long ret = expo(a, b / 2);
    ret = (ret % 1000000007 * ret % 1000000007) % 1000000007;
    ret = (ret % 1000000007 * a % 1000000007) % 1000000007;
    return ret;
  }
}
long long inverseMod(long long a, long long m) { return expo(a, m - 2) % m; }
long long fact[100005];
void factorial() {
  fact[0] = fact[1] = 1;
  for (int i = 2; i < 100005; i++)
    fact[i] = (fact[i - 1] % 1000000007 * i % 1000000007) % 1000000007;
}
long long GCD(long long a, long long b) {
  if (a == 0) return b;
  return GCD(b % a, a);
}
long long mult(long long a, long long b) {
  return (a % 1000000007 * b % 1000000007) % 1000000007;
}
long long add(long long a, long long b) {
  a += b;
  if (a >= 1000000007) return a - 1000000007;
  return a;
}
long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) return a + 1000000007;
  return a;
}
vector<int> primes;
void _precom() {
  for (int i = 0; i <= 200000; i++)
    if (isPrime[i]) primes.push_back(i);
}
void _run() {
  map<long long, vector<long long>> mp;
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    for (int j = 2; j * j <= v[i]; j++) {
      if (v[i] % j == 0) {
        int cnt = 0;
        while (v[i] % j == 0) cnt++, v[i] /= j;
        mp[j].push_back(cnt);
      }
    }
    if (v[i] != 1) mp[v[i]].push_back(1);
  }
  long long ans = 1;
  for (auto prime : primes) {
    if (mp.find(prime) != mp.end() && mp[prime].size() + 1 >= n) {
      sort(mp[prime].begin(), mp[prime].end());
      if (mp[prime].size() == n - 1) {
        ans *= expo(prime, mp[prime][0]);
      } else {
        ans *= expo(prime, mp[prime][1]);
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  _seive();
  _precom();
  int test = 1;
  while (test--) _run();
  return 0;
}
