#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5, MAXM = 2e6 + 5, Mod = 1e9 + 7;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
inline char gc() {
  return pp1 == pp2 &&
                 (pp2 = (pp1 = buf) + fread(buf, 1, 1 << 12, stdin), pp1 == pp2)
             ? EOF
             : *pp1++;
}
inline int read() {
  int x = 0;
  for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
    if (nc == 45) ny = -1;
  if (nc < 0) return nc;
  for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
       x = (x << 3) + (x << 1) + (nc ^ 48))
    ;
  return x * ny;
}
int p[MAXM], vis[MAXM], low[MAXM], cnt, g[MAXM], Max;
inline void Init(int n = 2e6) {
  for (int i = (2); i <= (n); i++) {
    if (!vis[i]) p[++cnt] = i, low[i] = i;
    for (int j = 1; j <= cnt && i * p[j] <= n; j++) {
      vis[i * p[j]] = 1, low[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
}
inline int Fp(int x, int k) {
  int ans = 1;
  for (; k; k >>= 1, x = 1ll * x * x % Mod)
    if (k & 1) ans = 1ll * ans * x % Mod;
  return ans;
}
int n, a[MAXN], Cnt[MAXM], Cntt[MAXM];
int main() {
  Init(), Max = 2e6, n = read();
  for (int i = (1); i <= (n); i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = (n); i >= (1); i--) {
    if (Cnt[a[i]]) {
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        Cnt[h] = max(Cnt[h], cnt);
      }
    } else
      Cnt[a[i]] = 1;
  }
  for (int i = (n); i >= (1); i--) {
    if (Cntt[a[i]]) {
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        if (cnt == Cnt[h]) g[h]++;
        Cntt[h] = max(Cntt[h], cnt);
      }
    } else
      Cntt[a[i]] = 1;
  }
  int flg = 0;
  memset(Cntt, 0, sizeof(Cntt));
  for (int i = (n); i >= (1); i--) {
    if (Cntt[a[i]]) {
      int tmp = 0;
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        if (cnt == Cnt[h] && g[h] == 1) tmp = 1;
        Cntt[h] = max(Cntt[h], cnt);
      }
      if (!tmp) flg = 1;
    } else
      Cntt[a[i]] = 1;
  }
  int ans = 1;
  for (int i = (1); i <= (Max); i++)
    if (Cnt[i]) ans = 1ll * ans * Fp(i, Cnt[i]) % Mod;
  ans = (ans + flg) % Mod;
  cout << ans << "\n";
  return 0;
}
