#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int n;
  cin >> n;
  long long g = 0, res = 0;
  for (int i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    if (i) {
      res = gcd(res, lcm(g, x));
    }
    g = gcd(g, x);
  }
  cout << res;
  return 0;
}
