#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
const int mod = 1e9 + 7;
class Solver {
  int n;
  vector<int> a;
  vector<int> g;

 public:
  long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
  long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
  void solve() {
    cin >> n;
    a.assign(n, 0);
    g.assign(n, 0);
    for (auto &i : a) cin >> i;
    for (int i = n - 1; i >= 0; i--) {
      g[i] = a[i];
      if (i + 1 < n) {
        g[i] = gcd(g[i], g[i + 1]);
      }
    }
    long long res = -1;
    for (int i = 0; i < n - 1; i++) {
      if (res == -1) {
        res = lcm(a[i], g[i + 1]);
      } else {
        res = gcd(res, lcm(a[i], g[i + 1]));
      }
    }
    cout << res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Solver s;
  s.solve();
}
