#include <bits/stdc++.h>
using namespace std;
long long gcdsh(long long x, long long y) {
  while (x && y) {
    x %= y;
    if (x) y %= x;
  }
  return x + y;
}
long long lcm(long long x, long long y) { return x / gcdsh(x, y) * y; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long i = 1, g, tmp, arr, ans;
  cin >> tmp;
  if (n == 1) {
    cout << tmp << '\n';
    return 0;
  }
  cin >> arr;
  g = gcdsh(tmp, arr);
  ans = tmp / g * arr;
  while (++i < n) {
    cin >> arr;
    tmp = lcm(g, arr);
    ans = gcdsh(ans, tmp);
    g = gcdsh(g, arr);
  }
  cout << ans << '\n';
}
