#include <bits/stdc++.h>
using namespace std;
int n, a[100005], m, u[100005], cnt[100005];
long long ans;
bool fl[100005];
vector<int> d[100005];
int count(int x) {
  int res = 0;
  for (int i = 0; i < d[x].size(); i++) res += cnt[d[x][i]] * u[d[x][i]];
  return res;
}
void update(int x, int y) {
  for (int i = 0; i < d[x].size(); i++) cnt[d[x][i]] += y;
}
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  scanf("%d", &n);
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x] = 1;
    m = max(m, x);
  }
  ans = m;
  for (int i = 1; i <= m; i++)
    for (int j = i; j <= m; j += i) d[j].push_back(i);
  for (int i = 1; i <= m; i++) u[i] = 1;
  for (int i = 2; i <= m; i++) {
    if (fl[i]) continue;
    u[i] = -1;
    for (int j = i * 2; j <= m; j += i) {
      fl[j] = 1;
      if ((j / i) % i == 0)
        u[j] = 0;
      else
        u[j] *= -1;
    }
  }
  for (int g = 1; g <= m; g++) {
    stack<int> s;
    for (int i = m / g; i > 0; i--) {
      if (!a[i * g]) continue;
      int c = count(i);
      while (c) {
        if (gcd(i, s.top()) == 1) {
          ans = max(ans, (long long)i * s.top() * g);
          c--;
        }
        update(s.top(), -1);
        s.pop();
      }
      s.push(i);
      update(i, 1);
    }
    while (s.size()) {
      update(s.top(), -1);
      s.pop();
    }
  }
  printf("%lld", ans);
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Given an array a, consisting of n integers, find:

$$$max_{1 ≤ i < j ≤ n} LCM(a_i,a_j),$$$

where LCM(x, y) is the smallest positive integer that is divisible by both x and y. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6.

Input

The first line contains an integer n (2 ≤ n ≤ 10^5) — the number of elements in the array a.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^5) — the elements of the array a.

Output

Print one integer, the maximum value of the least common multiple of two elements in the array a.

Examples

Input


3
13 35 77


Output


1001

Input


6
1 2 4 8 16 32


Output


32

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], m, u[100005], cnt[100005];
long long ans;
bool fl[100005];
vector<int> d[100005];
int count(int x) {
  int res = 0;
  for (int i = 0; i < d[x].size(); i++) res += cnt[d[x][i]] * u[d[x][i]];
  return res;
}
void update(int x, int y) {
  for (int i = 0; i < d[x].size(); i++) cnt[d[x][i]] += y;
}
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  scanf("%d", &n);
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x] = 1;
    m = max(m, x);
  }
  ans = m;
  for (int i = 1; i <= m; i++)
    for (int j = i; j <= m; j += i) d[j].push_back(i);
  for (int i = 1; i <= m; i++) u[i] = 1;
  for (int i = 2; i <= m; i++) {
    if (fl[i]) continue;
    u[i] = -1;
    for (int j = i * 2; j <= m; j += i) {
      fl[j] = 1;
      if ((j / i) % i == 0)
        u[j] = 0;
      else
        u[j] *= -1;
    }
  }
  for (int g = 1; g <= m; g++) {
    stack<int> s;
    for (int i = m / g; i > 0; i--) {
      if (!a[i * g]) continue;
      int c = count(i);
      while (c) {
        if (gcd(i, s.top()) == 1) {
          ans = max(ans, (long long)i * s.top() * g);
          c--;
        }
        update(s.top(), -1);
        s.pop();
      }
      s.push(i);
      update(i, 1);
    }
    while (s.size()) {
      update(s.top(), -1);
      s.pop();
    }
  }
  printf("%lld", ans);
  return 0;
}

```