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

### Prompt

Please provide a CPP coded solution to the problem described below:

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;
const int N = 100005;
int a[N], cnt[N];
int f[N], bj[N];
vector<int> d[N];
int n, mx;
long long ans;
void init(int n) {
  for (int i = 1; i <= n; i++) f[i] = 1;
  for (int i = 2; i <= n; i++) {
    if (bj[i]) continue;
    f[i] = -1;
    for (int j = i * 2; j <= n; j += i) {
      bj[j] = 1;
      f[j] = (j % (i * i)) ? f[j] * -1 : 0;
    }
  }
}
int count(int x) {
  int res = 0;
  for (int i = 0; i < d[x].size(); i++) {
    res += f[d[x][i]] * cnt[d[x][i]];
  }
  return res;
}
void add(int x, int v) {
  for (int i = 0; i < d[x].size(); i++) {
    cnt[d[x][i]] += v;
  }
}
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    mx = max(mx, x);
  }
  ans = mx;
  for (int i = 1; i <= mx; i++) {
    for (int j = i; j <= mx; j += i) {
      d[j].push_back(i);
    }
  }
  init(mx);
  for (int g = 1; g <= mx; g++) {
    stack<int> st;
    for (int i = mx / g; i >= 1; i--) {
      if (!a[i * g]) continue;
      int c = count(i);
      while (c) {
        if (gcd(i, st.top()) == 1) {
          ans = max(ans, (long long)i * g * st.top());
          c--;
        }
        add(st.top(), -1);
        st.pop();
      }
      st.push(i);
      add(i, 1);
    }
    while (!st.empty()) {
      add(st.top(), -1);
      st.pop();
    }
  }
  printf("%lld", ans);
  return 0;
}

```