#include <bits/stdc++.h>
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  for (; c > '9' || c < '0'; c = getchar()) {
    if (c == '-') f = -1;
  }
  for (; c >= '0' && c <= '9'; c = getchar()) {
    x = x * 10 + c - '0';
  }
  return x * f;
}
int a[100005];
std::vector<int> vec[200005];
inline long long q_pow(long long x, int t) {
  long long s = 1;
  for (; t; t >>= 1) {
    if (t & 1) s *= x;
    x *= x;
  }
  return s;
}
inline void divide(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i != 0) {
      vec[i].emplace_back(0);
      continue;
    }
    int cnt = 0;
    for (; x % i == 0; x /= i) cnt++;
    vec[i].emplace_back(cnt);
  }
  if (x != 1) vec[x].emplace_back(1);
}
inline void work() {
  int n = read();
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    divide(a[i]);
  }
  for (int i = 1; i <= 200000; i++) {
    std::sort(vec[i].begin(), vec[i].end());
    if (vec[i].size() < n - 2)
      continue;
    else if (vec[i].size() == n - 1 && !vec[i].empty())
      ans *= q_pow(i, vec[i][0]);
    else if (vec[i].size() == n && vec[i].size() >= 2)
      ans *= q_pow(i, vec[i][1]);
    else if (vec[i].size() == n && !vec[i].empty())
      ans *= i;
  }
  printf("%lld\n", ans);
}
int main() {
  work();
  return 0;
}
