#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '{' << p.first << ", " << p.second << '}';
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << '{';
  string sep;
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &mp) {
  os << '[';
  string sep;
  for (const auto &x : mp) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &s) {
  os << '{';
  string sep;
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long fast_pow(long long a, long long b) {
  if (b == 1) return a;
  if (b == 0) return 1;
  long long x = fast_pow(a, b / 2);
  x *= x;
  if (b & 1) x *= a;
  return x;
}
const long long nax = 2e5 + 10;
map<long long, multiset<long long>> mp;
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (long long i = 0; i < n; i++) {
    long long elem = v[i];
    for (long long j = 2; j * j <= elem; j++) {
      if (elem % j == 0) {
        long long cnt = 0;
        while (elem % j == 0) {
          cnt++;
          elem /= j;
        }
        mp[j].insert(cnt);
      }
    }
    if (elem > 1) {
      mp[elem].insert(1);
    }
  }
  long long ans = 1;
  for (auto i : mp) {
    if (i.second.size() < n - 1) continue;
    if (i.second.size() == n) {
      long long first = *i.second.begin();
      i.second.erase(i.second.begin());
      ans *= fast_pow(i.first, *i.second.begin());
      i.second.insert(first);
    } else {
      ans *= fast_pow(i.first, *i.second.begin());
    }
  }
  cout << ans << '\n';
}
int32_t main() {
  solve();
  return 0;
}
