#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 200007, __ = 2000007, mo = 1000000007;
int isnp[__] = {0}, lasp[__] = {0};
void fuck(int n = __ - 1) {
  for (int i = 2; i <= n; i++) {
    if (isnp[i]) continue;
    lasp[i] = i;
    for (long long j = 1ll * i * i; j <= n; j += i) {
      isnp[j] = 1;
      if (!lasp[j]) lasp[j] = i;
    }
  }
}
map<int, pair<int, int>> mp;
void gmax(int who, int d) {
  if (!who) return;
  if (mp[who].first < d) mp[who].second = 0;
  if (mp[who].first <= d) mp[who].first = d, mp[who].second++;
}
void add(int x) {
  int las = 0, cnt = 0;
  while (x > 1) {
    int a = lasp[x];
    x /= a;
    if (las != a) gmax(las, cnt), cnt = 0;
    las = a, cnt++;
  }
  if (cnt) gmax(las, cnt);
}
int finder(int x) {
  int las = 0, cnt = 0;
  while (x > 1) {
    int a = lasp[x];
    x /= a;
    if (las != a) {
      if (las && mp[las].first == cnt && mp[las].second == 1) return 0;
      cnt = 0;
    }
    las = a, cnt++;
  }
  if (las && mp[las].first == cnt && mp[las].second == 1) return 0;
  return 1;
}
int n, val[_], fr[__] = {0};
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  fuck();
  n = ty();
  for (int i = 1; i <= n; i++) val[i] = ty();
  sort(val + 1, val + n + 1, greater<int>());
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    add(val[i]);
  }
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    int cnt = j - i + 1;
    if (cnt + finder(val[i]) >= 2) {
      if (cnt == 1) {
        fr[val[i]] = 1;
        if (mp[val[i]].first == 1) mp[val[i]].second--;
      }
      add(val[i] - 1);
    }
  }
  int temp = 0;
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    int cnt = j - i + 1;
    if (cnt + (cnt == 1 ? fr[val[i]] : finder(val[i])) + finder(val[i] - 1) >=
        3)
      temp = 1;
  }
  long long ans = 1;
  for (auto i : mp)
    while (i.second.first--) ans = ans * i.first % mo;
  if (temp) ans = (ans + 1) % mo;
  cout << ans << lf;
  return 0;
}

### Prompt

Generate a CPP solution to the following problem:

You are given a tuple generator f^{(k)} = (f_1^{(k)}, f_2^{(k)}, ..., f_n^{(k)}), where f_i^{(k)} = (a_i ⋅ f_i^{(k - 1)} + b_i) mod p_i and f^{(0)} = (x_1, x_2, ..., x_n). Here x mod y denotes the remainder of x when divided by y. All p_i are primes.

One can see that with fixed sequences x_i, y_i, a_i the tuples f^{(k)} starting from some index will repeat tuples with smaller indices. Calculate the maximum number of different tuples (from all f^{(k)} for k ≥ 0) that can be produced by this generator, if x_i, a_i, b_i are integers in the range [0, p_i - 1] and can be chosen arbitrary. The answer can be large, so print the remainder it gives when divided by 10^9 + 7

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of elements in the tuple.

The second line contains n space separated prime numbers — the modules p_1, p_2, …, p_n (2 ≤ p_i ≤ 2 ⋅ 10^6).

Output

Print one integer — the maximum number of different tuples modulo 10^9 + 7.

Examples

Input

4
2 3 5 7


Output

210


Input

3
5 3 3


Output

30

Note

In the first example we can choose next parameters: a = [1, 1, 1, 1], b = [1, 1, 1, 1], x = [0, 0, 0, 0], then f_i^{(k)} = k mod p_i.

In the second example we can choose next parameters: a = [1, 1, 2], b = [1, 1, 0], x = [0, 0, 1].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 200007, __ = 2000007, mo = 1000000007;
int isnp[__] = {0}, lasp[__] = {0};
void fuck(int n = __ - 1) {
  for (int i = 2; i <= n; i++) {
    if (isnp[i]) continue;
    lasp[i] = i;
    for (long long j = 1ll * i * i; j <= n; j += i) {
      isnp[j] = 1;
      if (!lasp[j]) lasp[j] = i;
    }
  }
}
map<int, pair<int, int>> mp;
void gmax(int who, int d) {
  if (!who) return;
  if (mp[who].first < d) mp[who].second = 0;
  if (mp[who].first <= d) mp[who].first = d, mp[who].second++;
}
void add(int x) {
  int las = 0, cnt = 0;
  while (x > 1) {
    int a = lasp[x];
    x /= a;
    if (las != a) gmax(las, cnt), cnt = 0;
    las = a, cnt++;
  }
  if (cnt) gmax(las, cnt);
}
int finder(int x) {
  int las = 0, cnt = 0;
  while (x > 1) {
    int a = lasp[x];
    x /= a;
    if (las != a) {
      if (las && mp[las].first == cnt && mp[las].second == 1) return 0;
      cnt = 0;
    }
    las = a, cnt++;
  }
  if (las && mp[las].first == cnt && mp[las].second == 1) return 0;
  return 1;
}
int n, val[_], fr[__] = {0};
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  fuck();
  n = ty();
  for (int i = 1; i <= n; i++) val[i] = ty();
  sort(val + 1, val + n + 1, greater<int>());
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    add(val[i]);
  }
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    int cnt = j - i + 1;
    if (cnt + finder(val[i]) >= 2) {
      if (cnt == 1) {
        fr[val[i]] = 1;
        if (mp[val[i]].first == 1) mp[val[i]].second--;
      }
      add(val[i] - 1);
    }
  }
  int temp = 0;
  for (int i = 1, j = 1; i <= n; i = j + 1) {
    j = i;
    while (j < n && val[i] == val[j + 1]) j++;
    int cnt = j - i + 1;
    if (cnt + (cnt == 1 ? fr[val[i]] : finder(val[i])) + finder(val[i] - 1) >=
        3)
      temp = 1;
  }
  long long ans = 1;
  for (auto i : mp)
    while (i.second.first--) ans = ans * i.first % mo;
  if (temp) ans = (ans + 1) % mo;
  cout << ans << lf;
  return 0;
}

```