#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int N = 2e5 + 5;
int n, a[N];
map<int, vi> mp;
int main(int argc, char const *argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    for (int j = 2; j * j <= x; ++j) {
      if (x % j == 0) {
        int cnt = 0;
        while (x % j == 0) {
          cnt++;
          x /= j;
        }
        mp[j].emplace_back(cnt);
      }
    }
    if (x > 1) {
      mp[x].emplace_back(1);
    }
  }
  ll ans = 1;
  for (auto b : mp) {
    int p = b.first;
    vi c = b.second;
    sort(begin(c), end(c));
    int pw;
    if ((int)c.size() == n)
      pw = c[1];
    else if ((int)c.size() == n - 1)
      pw = c[0];
    else
      pw = 0;
    for (int i = 0; i < pw; ++i) {
      ans *= p;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
