#include <bits/stdc++.h>
using namespace std;
long long a[1000000], prime[1000000];
vector<long long> v[3000000];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(), cout.tie();
  long long e;
  for (long long i = 3; i * i <= 1000000; i += 2)
    if (a[i] == 0)
      for (long long j = i * i; j <= 1000000; j = j + (i * 2)) a[j] = 1;
  prime[0] = 2;
  for (long long i = 3, j = 1; i <= 1000000; i += 2)
    if (a[i] == 0) {
      prime[j++] = i;
      e = j;
    }
  long long n;
  cin >> n;
  long long b, c = 0, d = 1, f = 0, g = 0, h;
  for (long long i = 0; i < n; i++) {
    cin >> b;
    for (long long j = 0;; j++) {
      c = 0;
      if (prime[j] > sqrt(b)) {
        break;
      }
      if (b % prime[j] == 0) {
        while (b % prime[j] == 0) {
          c++;
          b /= prime[j];
        }
      }
      v[prime[j]].push_back(c);
      g = max(g, prime[j]);
    }
    if (b > 1) {
      g = max(g, b);
      v[b].push_back(1);
    }
  }
  for (long long i = 0; i < 210000; i++) {
    long long y = prime[i];
    if (v[y].size() == n - 1) {
      sort(v[y].begin(), v[y].end());
      long long x = v[y][0];
      d = d * (pow(y, x));
    }
    if (v[y].size() == n) {
      sort(v[y].begin(), v[y].end());
      long long x = v[y][1];
      d = d * (pow(y, x));
    }
  }
  cout << d << endl;
}
