#include <bits/stdc++.h>
using namespace std;
long long int ar[500009], cr[500009], br[500009], tr[500009];
long long int fx[] = {-1, 1, 0, 0};
long long int fy[] = {0, 0, 1, -1};
map<long long int, long long int> mp, mp1, mp2;
vector<long long int> v;
string s, q;
struct evan {
  long long int l, r, w;
} st[500009];
bool com(evan a, evan b) { return a.l < b.l; }
void fun() {
  long long int i, j;
  for (i = 2; i <= 2000; i++) {
    for (j = i + i; j <= 200000; j += i) {
      br[j] = 1;
    }
  }
  for (i = 2; i <= 200000; i++) {
    if (br[i] == 0) {
      v.push_back(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int a, b, c, d, e, i, j, k, x, y, z, f, g, h, n, m;
  fun();
  cin >> n;
  a = v.size();
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
    b = ar[i];
    for (j = 0; j < a and v[j] * v[j] <= b; j++) {
      if (b % v[j] == 0) {
        x = 1;
        while (b % v[j] == 0) {
          b = b / v[j];
          x = x * v[j];
          mp[x]++;
        }
      }
    }
    mp[b]++;
  }
  z = 1;
  for (i = 0; i < a; i++) {
    x = v[i];
    y = 1;
    for (j = 1; j <= 35; j++) {
      if (mp[x] >= n - 1) {
        y = x;
      } else {
        break;
      }
      x = x * v[i];
    }
    z *= y;
  }
  cout << z << endl;
}
