#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ '0');
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 2e5 + 5, M = 2e6 + 5, mod = 1e9 + 7;
int n, p[N], num[M], cnt[M], a[N];
inline int power(int b, int n) {
  int ans = 1;
  for (; n; n >>= 1, b = 1ll * b * b % mod)
    if (n & 1) ans = 1ll * ans * b % mod;
  return ans;
}
int insert(int p) {
  if (!num[p]) return num[p] = cnt[p] = 1, 0;
  --p;
  for (int i = 2; i <= sqrt(p); ++i) {
    if (p % i) continue;
    int c = 0;
    while (p % i == 0) p /= i, ++c;
    if (num[i] < c)
      num[i] = c, cnt[i] = 1;
    else if (num[i] == c)
      ++cnt[i];
  }
  if (p ^ 1) {
    int c = 1;
    if (num[p] < c)
      num[p] = c, cnt[p] = 1;
    else if (num[p] == c)
      ++cnt[p];
  }
  return 1;
}
bool check(int x) {
  for (int i = 2; i <= sqrt(x); ++i) {
    if (x % i) continue;
    int c = 0;
    while (x % i == 0) x /= i, ++c;
    if (c == num[i] && cnt[i] == 1) return 0;
  }
  if (x ^ 1 && num[x] == 1 && cnt[x] == 1) return 0;
  return 1;
}
int main() {
  n = read();
  for (int i = (1), _ed = (n); i <= _ed; ++i) p[i] = read();
  sort(p + 1, p + n + 1, [&](int a, int b) { return a > b; });
  for (int i = (1), _ed = (n); i <= _ed; ++i) a[i] = p[i] - insert(p[i]);
  int ans = 1;
  for (int i = (2), _ed = (M - 1); i <= _ed; ++i)
    ans = 1ll * ans * power(i, num[i]) % mod;
  for (int i = (1), _ed = (n); i <= _ed; ++i)
    if (check(a[i])) {
      ans = (ans + 1) % mod;
      break;
    }
  printf("%d\n", ans);
  return 0;
}
