#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug &operator<<(const c &) {
    return *this;
  }
};
void read(vector<long long> &a) {
  for (long long &i : a) cin >> i;
}
void read(vector<int> &a) {
  for (int &i : a) cin >> i;
}
int INF = 1e9;
long long mod = 1e9 + 7;
long long INF64 = 1e18;
long long fastp(long long b, long long e) {
  if (e == 0) return 1;
  if (e == 1) return b;
  long long cur = 1;
  while (e > 0) {
    if (e % 2) cur *= b;
    b *= b;
    e >>= 1;
  }
  return cur;
}
void test_case(int tnum) {
  int n;
  cin >> n;
  vector<int> a(n);
  read(a);
  map<int, vector<int>> cnt;
  for (int i = 0; i < n; i++) {
    int c2 = 0;
    while (a[i] % 2 == 0) {
      c2++;
      a[i] /= 2;
    }
    if (c2 != 0) {
      cnt[2].push_back(c2);
    }
    for (int j = 3; j * j <= a[i]; j += 2) {
      int cur = 0;
      while (a[i] % j == 0) {
        a[i] /= j;
        cur++;
      }
      if (cur != 0) {
        cnt[j].push_back(cur);
      }
    }
    if (a[i] > 1) {
      cnt[a[i]].push_back(1);
    }
  }
  long long ans = 1;
  for (auto i : cnt) {
    vector<int> me = i.second;
    long long base = i.first;
    long long ex = 0;
    sort(begin(me), end(me));
    if (me.size() == n) {
      ex = me[1];
    } else if (me.size() == n - 1) {
      ex = me[0];
    } else {
      ex = 0;
    }
    ans *= fastp(base, ex);
  }
  cout << ans << '\n';
}
int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  int t = 1;
  for (int test = 1; test <= t; test++) {
    test_case(test);
  }
  return 0;
}
