#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
char ch[] = {'N', 'S', 'E', 'W'};
template <class T>
inline T biton(T n, T pos) {
  return n | ((T)1 << pos);
}
template <class T>
inline T bitoff(T n, T pos) {
  return n & ~((T)1 << pos);
}
template <class T>
inline T ison(T n, T pos) {
  return (bool)(n & ((T)1 << pos));
}
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline T bigmod(T p, T e, T m) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
  }
  return (T)ret;
};
vector<int> primes;
void sieve(int n) {
  vector<int> vec(n + 1);
  vec[0] = vec[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (vec[i] == 0) {
      for (int j = i * 2; j <= n; j = j + i) {
        vec[j] = 1;
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    if (vec[i] == 0) {
      primes.push_back(i);
    }
  }
}
void solve() {
  int n;
  cin >> n;
  vector<int> items(n);
  for (int i = 0; i < n; i++) {
    cin >> items[i];
  }
  map<int, vector<int>> mp;
  for (int i = 0; i < n; i++) {
    int it = items[i];
    for (int j = 0; j < primes.size() && primes[j] * primes[j] <= it; j++) {
      int cnt = 0;
      while (it % primes[j] == 0) {
        cnt++;
        it = it / primes[j];
      }
      if (cnt > 0) {
        mp[primes[j]].push_back(cnt);
      }
    }
    if (it > 1) {
      mp[it].push_back(1);
    }
  }
  long long res = 1;
  for (auto m : mp) {
    sort(m.second.begin(), m.second.end());
    if (m.second.size() == n - 1) {
      res = res * pow(m.first, m.second[0]);
    } else if (m.second.size() == n) {
      res = res * pow(m.first, m.second[1]);
    }
  }
  cout << res << "\n";
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(10);
  cout.tie(nullptr);
  cin.tie(nullptr);
  sieve(2e5);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
