#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
const int Mod = 1e9 + 7;
int prm[N], fac[N], tot;
void init(int n) {
  for (int i = 2; i <= n; i++) {
    if (!prm[i]) prm[++tot] = i, fac[i] = i;
    for (int j = 1; j <= tot && i * prm[j] <= n; ++j) {
      int x = i * prm[j];
      prm[x] = true, fac[x] = prm[j];
      if (i % prm[j] == 0) break;
    }
  }
}
int n;
int A[N], cnt[N];
bool flag[N], vis[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
  init(N - 5);
  sort(A + 1, A + n + 1, greater<int>());
  for (int i = 1; i <= n; i++) {
    if (!cnt[A[i]])
      ++cnt[A[i]], flag[A[i]] = false, vis[i] = true;
    else {
      int x = A[i] - 1;
      while (x > 1) {
        int d = fac[x], c = 0;
        while (x % d == 0) ++c, x /= d;
        if (c > cnt[d])
          cnt[d] = c, flag[d] = false;
        else if (c == cnt[d])
          flag[d] = true;
      }
    }
  }
  int ans = 1;
  for (int i = 1; i <= N - 5; i++)
    for (int j = 1; j <= cnt[i]; j++) ans = 1ll * ans * i % Mod;
  bool ok = false;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      int x = A[i] - 1;
      bool del = true;
      while (x > 1) {
        int d = fac[x], c = 0;
        while (x % d == 0) ++c, x /= d;
        if (c == cnt[d] && !flag[d]) {
          del = false;
          break;
        }
      }
      if (del) {
        ok = true;
        break;
      }
    }
  ans = (ans + ok) % Mod;
  printf("%d\n", ans);
  return 0;
}
