#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 3;
vector<int> divs;
long long n, m, p, ans = 1, cntt;
int mark[maxn], apr[maxn];
vector<int> v;
bool func(long long a, long long b) { return (a < b); }
long long power(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long ans = power(a, b / 2);
  ans *= ans;
  if (b % 2 == 1) {
    ans *= a;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  mark[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (!mark[i]) {
      for (int j = i + i; j < maxn; j += i) {
        mark[j] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    v.push_back(0);
    cin >> v[i];
  }
  if (n == 1) {
    cout << v[0];
    return 0;
  }
  if (!mark[v[0]]) {
    divs.push_back(v[0]);
  }
  if (!mark[v[1]]) {
    divs.push_back(v[1]);
  }
  for (int i = 2; i <= sqrt(v[0]); i++) {
    if (!mark[i] && v[0] % i == 0) {
      if (!apr[i]) {
        divs.push_back(i);
        apr[i] = 1;
      }
    }
    if (!mark[v[0] / i] && !apr[v[0] / i]) {
      divs.push_back(v[0] / i);
      apr[v[0] / i] = 1;
    }
  }
  for (int i = 2; i <= sqrt(v[1]); i++) {
    if (!mark[i] && v[1] % i == 0) {
      if (!apr[i]) {
        divs.push_back(i);
        apr[i] = 1;
      }
    }
    if (!mark[v[1] / i] && !apr[v[1] / i]) {
      divs.push_back(v[1] / i);
      apr[v[1] / i] = 1;
    }
  }
  vector<int> cnt[divs.size()];
  for (int i = 0; i < n; i++) {
    p = 0;
    cntt = 0;
    while (p != divs.size()) {
      if (v[i] % divs[p] == 0) {
        cntt++;
        v[i] /= divs[p];
      } else {
        cnt[p].push_back(cntt);
        p++;
        cntt = 0;
      }
    }
  }
  for (int i = 0; i < divs.size(); i++) {
    sort(cnt[i].begin(), cnt[i].end(), func);
    ans *= power(divs[i], cnt[i][1]);
  }
  cout << ans;
  return 0;
}
