#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 7;
long long fact[MAXN], mini[MAXN], mini2[MAXN];
void factor() {
  for (long long i = 1; i <= 200005; ++i) fact[i] = -1;
  fact[1] = 1;
  for (long long i = 2; i <= 200005; ++i) {
    if (fact[i] == -1) {
      for (long long j = i; j <= 200005; j += i) {
        if (fact[j] == -1) fact[j] = i;
      }
    }
  }
}
long long pow(long long a, long long b) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
    }
    y = (y * y);
    b /= 2;
  }
  return x;
}
signed main() {
  factor();
  long long n;
  cin >> n;
  long long a[n + 1];
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (long long i = 1; i <= 200005; ++i) mini[i] = INT_MAX;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; ++i) {
    long long x = a[i];
    while (x != 1) {
      long long y = fact[x], cnt1 = 0;
      mp[y]++;
      while (x % y == 0) {
        x = x / y;
        cnt1++;
      }
      if (mini[y] >= cnt1) {
        mini2[y] = mini[y];
        mini[y] = cnt1;
      } else if (mini2[y] > cnt1) {
        mini2[y] = cnt1;
      }
    }
  }
  long long ans = 1;
  for (long long i = 2; i <= 200000; ++i) {
    if (mp[i] == n) {
      ans *= pow(i, mini2[i]);
    } else if (mp[i] == n - 1) {
      ans *= pow(i, mini[i]);
    }
  }
  cout << ans << "\n";
}
