#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 5;
vector<long long int> v[mx];
void solve() {
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    for (long long int j = 2; j * j <= x; ++j) {
      long long int c = 0;
      while (x % j == 0) {
        c++;
        x /= j;
      }
      if (c) {
        v[j].push_back(c);
      }
    }
    if (x) v[x].push_back(1);
  }
  long long int f = 1;
  for (long long int i = 1; i < mx; ++i) {
    sort(v[i].rbegin(), v[i].rend());
    long long int idx = n - 2;
    if (idx < v[i].size()) {
      long long int times = v[i][idx];
      for (long long int p = 0; p < times; ++p) f *= i;
    }
  }
  cout << f << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
