#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  while (test--) {
    long long n;
    cin >> n;
    vector<long long> a;
    for (long long i = 0; i < n; i++) {
      long long temp;
      cin >> temp;
      a.push_back(temp);
    };
    map<long long, map<long long, long long>> x;
    for (long long i = 0; i < n; i++) {
      long long temp = a[i];
      for (long long j = 2; j <= sqrt(temp); j++) {
        long long cnt = 0;
        while (temp % j == 0) {
          cnt++;
          temp /= j;
        }
        if (cnt != 0) x[j][cnt]++;
      }
      if (temp > 1) x[temp][1]++;
    }
    long long ans = 1;
    for (auto i : x) {
      long long cnt = 0;
      for (auto j : i.second) {
        cnt += j.second;
      }
      if (cnt >= n - 1) {
        long long tempo = 0;
        if (cnt == n) {
          long long dudu = 2;
          for (auto j : i.second) {
            for (long long k = 0; k < j.second && dudu; k++) {
              tempo = j.first;
              dudu--;
            }
          }
        } else {
          for (auto j : i.second) {
            tempo += j.first;
            break;
          }
        }
        ans *= pow(i.first, tempo);
      }
    }
    cout << ans << "\n";
  }
}
