#include <bits/stdc++.h>
using namespace std;
int n, a[100001], cnt;
long long ans;
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
long long lcm(int x, int y) {
  long long res = 1ll * x * y;
  return res / gcd(x, y);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  n = unique(a + 1, a + n + 1) - a - 1;
  for (int i = n; i >= 1; i--)
    if (i >= n - 30 || (((a[i] ^ a[n]) & 1) && cnt < 30)) {
      for (int j = n; j >= 1; j--) ans = max(ans, lcm(a[i], a[j]));
      if (i < n - 30) cnt++;
    }
  cout << ans << '\n';
  return 0;
}
