#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <typename T>
T gcd(T a, T b) {
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
T mod_exp(T b, T p, T m) {
  T x = 1;
  while (p) {
    if (p & 1) x = (x * b) % m;
    b = (b * b) % m;
    p = p >> 1;
  }
  return x;
}
template <typename T>
T invFermat(T a, T p) {
  return mod_exp(a, p - 2, p);
}
template <typename T>
T exp(T b, T p) {
  T x = 1;
  while (p) {
    if (p & 1) x = (x * b);
    b = (b * b);
    p = p >> 1;
  }
  return x;
}
string tostring(long long number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
long long mpow(long long base, long long exp) {
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base);
    base = (base * base);
    exp >>= 1;
  }
  return result;
}
const long long maxm = 1e6 + 1;
vector<bool> is_prime(maxm, true);
void sieve() {
  is_prime[0] = is_prime[1] = false;
  for (long long i = 2; i * i <= maxm; i++) {
    if (is_prime[i]) {
      for (long long j = i * i; j <= maxm; j += i) is_prime[j] = false;
    }
  }
}
const long long MAX = 200005;
long long existin[MAX]{0};
pair<long long, long long> cnt[MAX];
void check(long long x) {
  long long temp = x;
  for (long long i = 2; i * i <= x; i++) {
    long long res = 0;
    while (temp % i == 0) {
      temp /= i;
      res++;
    }
    if (res) existin[i]++;
    if (cnt[i].first > res) {
      swap(cnt[i].first, cnt[i].second);
      cnt[i].first = res;
    } else if (cnt[i].second > res)
      cnt[i].second = res;
  }
  if (temp != 1) {
    if (cnt[temp].first > 1) {
      swap(cnt[temp].first, cnt[temp].second);
      cnt[temp].first = 1;
    } else if (cnt[temp].second > 1)
      cnt[temp].second = 1;
    existin[temp]++;
  }
}
void sol() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long dum = MAX;
  for (__typeof(dum) i = (0) - ((0) > (dum)); i != (dum) - ((0) > (dum));
       i += 1 - 2 * ((0) > (dum)))
    cnt[i] = {INT_MAX, INT_MAX};
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> v[i];
    check(v[i]);
  }
  long long ans = 1;
  for (__typeof(dum) i = (0) - ((0) > (dum)); i != (dum) - ((0) > (dum));
       i += 1 - 2 * ((0) > (dum))) {
    if (existin[i] == n) {
      long long miniposs = max(cnt[i].first, cnt[i].second);
      ans *= mpow(i, miniposs);
    } else if (existin[i] == n - 1) {
      long long miniposs =
          max(cnt[i].first, cnt[i].second != INT_MAX ? cnt[i].second : 0);
      ans *= mpow(i, miniposs);
    }
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    sol();
  }
}
