#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return (b ? gcd(b, a % b) : a);
}
const int inf = 1e5;
void solve() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 2) {
    cout << a[0] * a[1] / gcd(a[0], a[1]) << endl;
    return;
  }
  map<long long int, long long int> countp;
  map<long long int, pair<long long int, long long int> > maxip;
  for (long long int j = 0; j < n; j++) {
    long long int val = a[j];
    for (long long int i = 2; i * i <= val; i++) {
      long long int count = 0;
      if (val % i == 0) {
        while (val % i == 0) {
          count++;
          val /= i;
        }
        countp[i]++;
        if (maxip.find(i) != maxip.end()) {
          if (count < maxip[i].first) {
            maxip[i].second = maxip[i].first;
            maxip[i].first = count;
          } else if (count < maxip[i].second)
            maxip[i].second = count;
        } else {
          maxip[i].first = count;
          maxip[i].second = inf;
        }
      }
    }
    if (val > 1) {
      long long int i = val;
      long long int count = 1;
      countp[val]++;
      if (maxip.find(i) != maxip.end()) {
        if (count < maxip[i].first) {
          maxip[i].second = maxip[i].first;
          maxip[i].first = count;
        } else if (count < maxip[i].second)
          maxip[i].second = count;
      } else {
        maxip[i].first = count;
        maxip[i].second = inf;
      }
    }
  }
  long long int ans = 1;
  for (auto e : countp) {
    if (e.second > n - 1) {
      ans *= pow(e.first, maxip[e.first].second);
    } else if (e.second == n - 1) {
      ans *= pow(e.first, maxip[e.first].first);
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  solve();
}
