#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
  i >> p.x >> p.y;
  return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
  for (auto& v : t) {
    i >> v;
  }
  return i;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& o, const pair<T, U>& p) {
  o << p.x << ' ' << p.y;
  return o;
}
template <typename T>
std::ostream& operator<<(std::ostream& o, const vector<T>& t) {
  if (t.empty()) o << '\n';
  for (size_t i = 0; i < t.size(); ++i) {
    o << t[i] << " \n"[i == t.size() - 1];
  }
  return o;
}
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  return b ? gcd(b, a % b) : a;
}
int n, m;
void solve(istream& cin, ostream& cout) {
  cin >> n;
  vector<long long> A(n);
  cin >> A;
  map<int, multiset<int>> M;
  for (int(i) = 0; (i) < (int)(n); (i)++) {
    for (long long p = 2; p * p <= A[i]; p++) {
      int sz = 0;
      while (A[i] % p == 0) {
        A[i] /= p;
        sz++;
      }
      if (sz) M[p].insert(sz);
    }
    if (A[i] > 1) {
      M[A[i]].insert(1);
    }
  }
  long long ans = 1;
  for (auto& p : M) {
    if (p.second.size() == n) {
      auto e = *(++p.second.begin());
      for (int(k) = 0; (k) < (int)(e); (k)++) ans = (ans * p.first);
    } else if (p.second.size() == n - 1) {
      auto e = *(p.second.begin());
      for (int(k) = 0; (k) < (int)(e); (k)++) ans = (ans * p.first);
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve(cin, cout);
  return 0;
}
