#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cnt = 0;
  vector<int> vis(200005, -1);
  vector<int> prime;
  for (int i = 1; i <= 200000; ++i) {
    bool flag = 1;
    for (int j = 2; j <= i / j; ++j)
      if (i % j == 0) {
        flag = 0;
        break;
      }
    if (flag) {
      vis[i] = cnt++;
      prime.push_back(i);
    }
  }
  vector<vector<int>> p;
  p.resize(cnt);
  for (int i = 0; i < n; ++i) {
    for (int j = 2; j <= a[i] / j; ++j) {
      if (a[i] % j == 0) {
        int c = 0;
        while (a[i] % j == 0) {
          ++c;
          a[i] /= j;
        }
        p[vis[j]].push_back(c);
      }
    }
    if (a[i] > 1) {
      p[vis[a[i]]].push_back(1);
    }
  }
  long long ans = 1;
  for (int i = 0; i < cnt; ++i) {
    sort(p[i].begin(), p[i].end());
    if ((int)p[i].size() == n - 1) {
      ans *= pow(1ll * prime[i], p[i][0]);
    }
    if ((int)p[i].size() == n) {
      ans *= pow(1ll * prime[i], p[i][1]);
    }
  }
  cout << ans << endl;
  return 0;
}
