#include <bits/stdc++.h>
using namespace std;
void print(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
long long int power(long long int x) {
  long long int u = 0;
  while (x % 2 == 0) {
    u++;
    x = x / 2;
  }
  return u;
}
long long int powM(long long int x, long long int y, long long int m) {
  long long int ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y) {
    if (r & y) {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  long long int M = 1e9 + 7;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long int b[n - 1];
    b[n - 2] = a[n - 1];
    for (long long int i = n - 3; i >= 0; i--) {
      b[i] = gcd(b[i + 1], a[i + 1]);
    }
    long long int c[n - 1];
    for (long long int i = 0; i < n - 1; i++) {
      c[i] = (a[i] * b[i]) / gcd(a[i], b[i]);
    }
    long long int u = c[0];
    for (long long int i = 1; i < n - 1; i++) {
      u = gcd(u, c[i]);
    }
    cout << u << "\n";
  }
  return 0;
}
