#include <bits/stdc++.h>
using namespace std;
const int N = 2000100;
const int mod = 1e9 + 7;
bool isnotprime[N];
int prime[N], cnt, f[N], p[N], c[N], cc[N];
void get_prime() {
  isnotprime[1] = true;
  for (int i = 2; i <= 2e6; i++) {
    if (!isnotprime[i]) prime[++cnt] = i, f[i] = i;
    for (int j = 1; j <= cnt && i * prime[j] <= 2e6; j++) {
      isnotprime[i * prime[j]] = true, f[i * prime[j]] = prime[j];
      if (!(i % prime[j])) break;
    }
  }
}
int main() {
  get_prime();
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  sort(p + 1, p + 1 + n);
  for (int i = n; i; i--) {
    if (!c[p[i]])
      c[p[i]] = 1, cc[p[i]] = 1;
    else {
      int tmp = --p[i];
      while (tmp != 1) {
        int tp = f[tmp], tc = 0;
        while (!(tmp % tp)) tmp /= tp, tc++;
        if (tc > c[tp])
          c[tp] = tc, cc[tp] = 1;
        else if (tc == c[tp])
          cc[tp]++;
      }
    }
  }
  int ans = 1;
  for (int i = 1; i <= 2e6; i++)
    for (int j = 1; j <= c[i]; j++) ans = 1ll * ans * i % mod;
  for (int i = 1; i <= n; i++)
    if (isnotprime[p[i]]) {
      bool flag = false;
      while (p[i] != 1) {
        int tp = f[p[i]], tc = 0;
        while (!(p[i] % tp)) p[i] /= tp, tc++;
        if (tc == c[tp] && cc[tp] == 1) {
          flag = true;
          break;
        }
      }
      if (!flag) {
        ans = (ans + 1) % mod;
        break;
      }
    }
  printf("%d\n", ans);
  return 0;
}
