#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932384626433832795;
int dar(int a, int b) {
  if (b == 0) return 1;
  if (b & 1) return a * dar(a, b - 1);
  int jv = dar(a, b / 2);
  return (jv) * (jv);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) scanf("%d", &i);
  int tub[200010];
  memset(tub, -1, sizeof(tub));
  tub[0] = tub[1] = 1;
  for (int i = 2; i <= 200010; i++) {
    if (tub[i] == -1) {
      for (int j = i; j <= 200010; j += i) tub[j] = i;
    }
  }
  map<pair<int, int>, int> jtb;
  for (int i = 0; i < n; i++) {
    int t = a[i];
    map<int, int> tb;
    while (t > 1) {
      tb[tub[t]]++;
      t /= tub[t];
    }
    for (auto _i : tb) {
      for (int k = _i.second; k >= 1; k--) jtb[{_i.first, k}]++;
    }
  }
  long long jv = 1;
  for (auto it = jtb.begin(); it != jtb.end(); it++) {
    if (it->second == n || it->second == n - 1) {
      while (jv % it->first.first == 0) jv /= it->first.first;
      jv *= dar(it->first.first, it->first.second);
    }
  }
  cout << jv << endl;
  return 0;
}
