#include <bits/stdc++.h>
using namespace std;
bool sito[200001];
vector<int> pier;
unordered_map<int, int> doda;
pair<int, int> ile[100];
int tab[100005];
int main() {
  for (int i = 2; i * i <= 200000; i++) {
    if (!sito[i]) {
      for (int j = i + i; j * j <= 200000; j += i) {
        sito[j] = true;
      }
      pier.push_back(i);
    }
  }
  int n;
  cin >> n;
  int licz;
  cin >> tab[0];
  for (int j = 0; j < pier.size(); j++) {
    licz = 0;
    while (tab[0] % pier[j] == 0) {
      licz++;
      tab[0] /= pier[j];
    }
    ile[j].first = licz;
    ile[j].second = 100000000;
  }
  if (tab[0] != 1) {
    doda[tab[0]]++;
  }
  for (int i = 1; i < n; i++) {
    cin >> tab[i];
    for (int j = 0; j < pier.size(); j++) {
      licz = 0;
      while (tab[i] % pier[j] == 0) {
        licz++;
        tab[i] /= pier[j];
      }
      if (licz <= ile[j].first) {
        ile[j].second = ile[j].first;
        ile[j].first = licz;
      } else {
        ile[j].second = min(ile[j].second, licz);
      }
    }
    if (tab[i] != 1) {
      doda[tab[i]]++;
    }
  }
  long long wyn = 1;
  for (int i = 0; i < 100; i++) {
    if (ile[i].second == 100000000) {
      continue;
    }
    while (ile[i].second) {
      ile[i].second--;
      wyn *= pier[i];
    }
  }
  for (auto it = doda.begin(); it != doda.end(); it++) {
    if ((*it).second >= n - 1) {
      wyn *= (*it).first;
    }
  }
  cout << wyn << "\n";
  return 0;
}
