#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 10000020;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  int val = 0;
  for (; !isdigit(buf[bufpos]); bufpos++)
    ;
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
const int maxm = 2000002;
const int maxn = 200002;
const int mod = 1000000007;
int c[maxm];
bool ntprime[maxm];
int primes[maxm], cur;
void sieve(int n) {
  ntprime[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!ntprime[i]) {
      primes[++cur] = i;
      c[i] = i;
    }
    for (int j = 1; j <= cur; j++) {
      int t = i * primes[j];
      if (t > n) break;
      ntprime[t] = 1;
      c[t] = primes[j];
      if (i % primes[j] == 0) break;
    }
  }
}
int a[maxn];
int e[maxm], tat[maxm];
bool f[maxn];
int main() {
  init();
  int n = readint();
  sieve(2000000);
  for (int i = 1; i <= n; i++) a[i] = readint();
  sort(a + 1, a + n + 1);
  bool qwq = false;
  for (int i = n; i; i--)
    if (!e[a[i]])
      e[a[i]] = 1;
    else {
      f[i] = 1;
      int t = a[i] - 1;
      while (t != 1) {
        int s = 0, w = c[t];
        while (c[t] == w) t /= w, s++;
        if (e[w] < s)
          e[w] = s, tat[w] = 1;
        else if (e[w] == s)
          tat[w]++;
      }
    }
  for (int i = 1; i <= n; i++) {
    if (!f[i]) {
      if (e[a[i]] > 1 || tat[a[i]] > 1) qwq = true;
      continue;
    }
    int t = a[i] - 1;
    bool flag = false;
    while (t != 1) {
      int s = 0, w = c[t];
      while (c[t] == w) t /= w, s++;
      if (e[w] == s && tat[w] == 1) flag = true;
    }
    if (!flag) qwq = true;
  }
  long long ans = 1;
  for (int i = 1; i <= 2000000; i++)
    while (e[i]--) {
      ans = ans * i % mod;
    }
  if (qwq) ans = (ans + 1) % mod;
  printf("%lld", ans);
}
