#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  while (c < 48) c == '-' && (f = -1), c = getchar();
  while (c > 47) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
const int MAXN = 100005;
std::vector<long long> adj;
long long n, ans;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main(int argc, char const *argv[]) {
  n = read();
  for (int i = 1; i <= n; ++i) adj.push_back(read());
  sort(adj.rbegin(), adj.rend());
  long long mx[5] = {1, *adj.begin(), 1, 1, 1};
  ans = 0;
  if (adj.size() > 1) mx[2] = adj[1];
  if (adj.size() > 2) mx[3] = adj[2];
  for (long long i : adj)
    if (i % 2 != mx[1] % 2) mx[4] = max(mx[4], i);
  for (int i = 1; i <= 4; ++i)
    for (long long x : adj) ans = max(ans, lcm(mx[i], x));
  printf("%lld\n", ans);
  return 0;
}
