#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  for (int i = 1; i <= 100000; i++) {
    if (!a[i]) continue;
    for (int j = 2 * i; j <= 100000; j += i)
      if (a[j]) {
        a[i] = 0;
        break;
      }
  }
  vector<int> v;
  for (int i = 1; i <= 100000; i++)
    if (a[i]) v.push_back(i);
  reverse(v.begin(), v.end());
  long long int ans = v.back();
  for (int i = 0; i < v.size(); i++) {
    int bef = 10000123;
    for (int j = i + 1; j < v.size(); j++) {
      if (ans >= 1LL * v[i] * v[j]) break;
      if (v[j] % bef == 0) continue;
      int c = gcd(v[i], v[j]);
      if (bef <= c) continue;
      bef = c;
      ans = max(ans, 1LL * v[i] * v[j] / bef);
    }
  }
  cout << ans << endl;
}
