#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MOD = (int)1e9 + 7;
inline int fpm(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = (long long)x * x % MOD)
    if (y & 1) res = (long long)res * x % MOD;
  return res;
}
const int MAXN = (int)2e5, M = (int)2e6;
namespace MATH {
int p[M + 5], prime[M + 5], prime_cnt = 0;
inline void linear_sieve() {
  p[1] = 0;
  for (int i = 2; i <= M; ++i) {
    if (!p[i]) p[i] = i, prime[++prime_cnt] = i;
    for (int j = 1; j <= M && i * prime[j] <= M; ++j) {
      p[i * prime[j]] = prime[j];
      if (i % prime[j] == 0) break;
    }
  }
}
}  // namespace MATH
using MATH::p;
using MATH::prime;
using MATH::prime_cnt;
int n;
int a[MAXN + 5];
inline void input() {
  n = read<int>();
  for (int i = 1; i <= n; ++i) a[i] = read<int>();
}
inline void solve() {
  static int bkt[M + 5], id[M + 5], cnt[M + 5];
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 1; i <= n; ++i)
    if (bkt[a[i]] >= 1)
      for (int k = a[i] - 1; k > 1;) {
        int d = p[k], e = 0;
        while (k % d == 0) k /= d, ++e;
        if (chkmax(bkt[d], e))
          id[d] = i, cnt[d] = 1;
        else if (bkt[d] == e)
          ++cnt[d];
      }
    else
      bkt[a[i]] = 1, cnt[a[i]] = 1, id[a[i]] = i;
  static int vis[MAXN + 5];
  int pre = 0;
  for (int i = 1; i <= M; ++i)
    if (p[i] == i && cnt[i] == 1) vis[id[i]] = 1;
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) {
      pre = 1;
      break;
    }
  int ans = 1;
  for (int i = 2; i <= M; ++i)
    if (p[i] == i) ans = (long long)ans * fpm(i, bkt[i]) % MOD;
  printf("%d\n", (pre + ans + MOD) % MOD);
}
int main() {
  MATH::linear_sieve();
  input();
  solve();
  return 0;
}
