#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pi = pair<int, int>;
using vpi = vector<pi>;
using pl = pair<ll, ll>;
using vpl = vector<pl>;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
void print(std::vector<T> a) {
  int sz = a.size();
  for (int i = 0; i < a.size(); i++) cout << a[i] << (i < sz - 1 ? ' ' : '\n');
}
void ioboost() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
}
long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long extgcd(long long a, long long b, long long& x, long long& y) {
  long long g = a;
  x = 1;
  y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
int main(void) {
  ioboost();
  int n;
  cin >> n;
  vl a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vl r(n), l(n);
  for (int i = 0; i < n; i++) {
    if (!i)
      r[i] = a[i], l[n - 1] = a[n - 1];
    else
      r[i] = gcd(r[i - 1], a[i]), l[n - 1 - i] = gcd(l[n - i], a[n - 1 - i]);
  }
  ll ans = 1;
  for (int i = 0; i < n; i++) {
    if (!i)
      ans = lcm(ans, l[1]);
    else if (i == n - 1)
      ans = lcm(ans, r[n - 2]);
    else
      ans = lcm(ans, gcd(r[i - 1], l[i + 1]));
  }
  cout << ans << '\n';
}
