#include <bits/stdc++.h>
using namespace std;
const long long X = 1e7 + 1;
long long mac[1000001];
long long used[20000001];
vector<long long> dell;
vector<long long> mb;
long long ans = 1;
long long b;
void del(long long a) {
  for (long long i = 1; i * i <= a; i++) {
    if (a % i == 0) {
      used[i]++;
      if (a / i != i) used[a / i]++;
    }
  }
}
long long gcd(long long a, long long x) {
  if (a < x) {
    swap(a, x);
  }
  if (x == 0) {
    return a;
  }
  return gcd(x, a % x);
}
int main() {
  long long t;
  long long a;
  cin >> a;
  b = a;
  for (long long i = 0; i < a; i++) {
    cin >> mac[i];
    del(mac[i]);
  }
  for (long long i = 0; i < 2000001; i++) {
    if (used[i] >= a - 1) {
      mb.push_back(i);
    }
  }
  for (long long i = 0; i < mb.size(); i++) {
    ans /= gcd(ans, mb[i]);
    ans *= mb[i];
  }
  cout << ans;
}
