#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e17;
const long long int NINF = -INF;
const long long int max_n = 1e5 + 10;
long long int fact[max_n];
long long int power(long long int a, long long int n,
                    long long int m = 1000000007) {
  long long int res = 1;
  a = a % m;
  while (n) {
    if (n & 1) {
      res = (res * a) % m;
      n--;
    } else {
      a = (a * a) % m;
      n = n / 2;
    }
  }
  return res;
}
long long int combination(long long int n, long long int k) {
  if (n < k) return 0;
  if (k == 0 || k == n) return 1;
  long long int res = fact[n];
  res = (res * power(fact[k], 1000000007 - 2, 1000000007)) % 1000000007;
  res = (res * power(fact[n - k], 1000000007 - 2, 1000000007)) % 1000000007;
  return res;
}
struct node {
  long long int count = 0;
  long long int first = INF;
  long long int second = INF;
  long long int min_power = INF;
};
void solve(long long int tc = 1) {
  long long int n;
  cin >> n;
  vector<long long int> arr(n);
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  vector<struct node> mp(2 * max_n);
  for (long long int i = 0; i < n; i++) {
    long long int num = arr[i];
    for (long long int j = 2; j * j <= arr[i]; j++) {
      long long int p = 0;
      while (num % j == 0) {
        num = num / j;
        p++;
      }
      if (p > 0) {
        mp[j].count++;
        if (mp[j].first > p) {
          mp[j].second = mp[j].first;
          mp[j].first = p;
        } else if (mp[j].second > p)
          mp[j].second = p;
        mp[j].min_power = min(mp[j].min_power, p);
      }
    }
    if (num > 1) {
      mp[num].count++;
      if (mp[num].first > 1) {
        mp[num].second = mp[num].first;
        mp[num].first = 1;
      } else if (mp[num].second > 1)
        mp[num].second = 1;
      mp[num].min_power = 1;
    }
  }
  long long int ans = 1;
  for (long long int i = 1; i < 2 * max_n; i++) {
    if (mp[i].count == n)
      ans = ans * pow(i, mp[i].second);
    else if (mp[i].count == (n - 1))
      ans = ans * pow(i, mp[i].min_power);
  }
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  long long int tc = 1;
  while (t--) {
    solve(tc);
    tc++;
  }
  return 0;
}
