#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int maxn = 1e5 + 10;
const int modd = 1e9;
long long a[100010];
long long p[100010];
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  p[n] = a[n];
  for (int i = n - 1; i > 0; i--) {
    p[i] = gcd(p[i + 1], a[i]);
  }
  long long ans = a[1] / gcd(a[1], p[2]) * p[2];
  for (int i = 2; i <= n; i++) {
    ans = gcd(ans, p[i + 1] / gcd(a[i], p[i + 1]) * a[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
