#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MAX5 = 1e+5 + 7;
const long long MAX7 = 1e+7 + 7;
const long long MAXN = MAX7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
const long long MOD = 1e+9 + 7;
long long T = 1;
long long n0, n1, n2, x, k, n;
string second;
vector<long long> prime(2000001);
vector<long long> pr;
void PRIME() {
  for (long long i = 0; i <= 2000000; i++) {
    prime[i] = i;
  }
  pr.push_back(2);
  for (long long i = 4; i <= 2000000; i += 2) {
    prime[i] = 2;
  }
  for (long long i = 3; i <= 2000000; i += 2) {
    if (prime[i] == i) {
      pr.push_back(i);
      for (long long j = i * i; j <= 2000000; j += i) {
        if (prime[j] == j) prime[j] = i;
      }
    }
  }
}
unordered_map<long long, long long> factorize(long long x) {
  unordered_map<long long, long long> ans;
  while (x > 1) {
    long long m = prime[x];
    while (x % m == 0) {
      ans[m] = (ans[m] + 1) % MOD;
      x /= m;
    }
  }
  return ans;
}
void MAIN() {
  cin >> n;
  vector<long long> val(n + 1);
  unordered_map<long long, long long> ans[2];
  long long max1 = 1;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    val[i] = x;
    max1 = max(max1, x);
  }
  long long Ans = 1;
  long long j = 0;
  ans[0] = factorize(val[0]);
  ans[1] = factorize(val[1]);
  for (auto it : ans[1]) {
    if (ans[0][it.first] > ans[1][it.first]) {
      swap(ans[0][it.first], ans[1][it.first]);
      ;
    }
  }
  for (auto it : ans[0]) {
    if (ans[0][it.first] > ans[1][it.first]) {
      swap(ans[0][it.first], ans[1][it.first]);
      ;
    }
  }
  for (long long i = 2; i < n; i++) {
    unordered_map<long long, long long> temp = factorize(val[i]);
    for (auto it : ans[0]) {
      if (ans[0][it.first] > temp[it.first]) {
        swap(ans[0][it.first], ans[1][it.first]);
        ;
        swap(ans[0][it.first], temp[it.first]);
        ;
      } else if (ans[1][it.first] > temp[it.first]) {
        swap(ans[1][it.first], temp[it.first]);
      }
    }
  }
  for (auto it : ans[1]) {
    Ans = Ans * pow(it.first, it.second);
  }
  cout << Ans;
  cout << "\n";
}
int main() {
  PRIME();
  while (T--) {
    MAIN();
  }
  return 0;
}
