#include <bits/stdc++.h>
using namespace std;
long long a[100001];
vector<int> b[200001];
int c[200001];
long long go(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x;
  else if (y & 1) {
    return go(x, y - 1) * x;
  } else {
    long long tmp = go(x, y / 2);
    return tmp * tmp;
  }
}
int gcd(int x, int y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 2) {
    cout << a[0] * a[1] / gcd(a[0], a[1]) << '\n';
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int t = a[i];
    for (int j = 2; j * j <= t; j++) {
      int cnt = 0;
      while (t % j == 0) {
        t /= j;
        cnt += 1;
      }
      if (cnt > 0) {
        c[j] += 1;
        b[j].push_back(cnt);
      }
    }
    c[t] += 1;
    b[t].push_back(1);
  }
  long long cnt = 1;
  for (int i = 2; i <= 200000; i++) {
    if (c[i] >= n - 1) {
      sort(b[i].begin(), b[i].end());
      if (c[i] == n - 1)
        cnt *= go(i, b[i][0]);
      else
        cnt *= go(i, b[i][1]);
    }
  }
  cout << cnt << '\n';
}
