#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
long long spf[MAXN];
long long min1[MAXN];
long long min2[MAXN];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < MAXN; i++) spf[i] = i;
  for (int i = 4; i < MAXN; i += 2) spf[i] = 2;
  for (int i = 3; i * i < MAXN; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < MAXN; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<pair<int, int>> getFactorization(int x) {
  vector<pair<int, int>> ret;
  while (x != 1) {
    int cur = spf[x];
    int cnt = 0;
    while (x && spf[x] == cur) {
      ++cnt;
      x = x / spf[x];
    }
    ret.push_back({cur, cnt});
  }
  return ret;
}
void solve() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (auto &a : arr) {
    cin >> a;
  }
  sieve();
  memset(min1, -1, sizeof(min1));
  memset(min2, -1, sizeof(min2));
  vector<int> many(MAXN, 0);
  for (int i = 0; i < n; ++i) {
    int x = arr[i];
    vector<pair<int, int>> fact = getFactorization(x);
    for (auto ff : fact) {
      int p = ff.first;
      int c = ff.second;
      if (min1[p] == -1) {
        min1[p] = c;
      } else if (min2[p] == -1) {
        int m = min1[p];
        if (c <= m) {
          min1[p] = c;
          min2[p] = m;
        } else {
          min1[p] = m;
          min2[p] = c;
        }
      } else {
        int m1 = min1[p];
        int m2 = min2[p];
        if (c <= m1) {
          min1[p] = c;
          min2[p] = m1;
        } else if (c <= m2) {
          min2[p] = m2;
        }
      }
      ++many[p];
    }
  }
  long long res = 1;
  for (int i = 2; i < MAXN; ++i) {
    if (many[i] == n) {
      res *= pow(1ll * i, min2[i]);
    } else if (many[i] == n - 1) {
      res *= pow(1ll * i, min1[i]);
    }
  }
  cout << res << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
