#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000005, P = 1e9 + 7;
int n, pr[maxn], mp[maxn];
bool vis[maxn];
void getP(int n) {
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) pr[++pr[0]] = i, mp[i] = i;
    for (int j = 1; j <= pr[0] && i * pr[j] <= n; j++) {
      vis[i * pr[j]] = true;
      mp[i * pr[j]] = pr[j];
      if (i % pr[j] == 0) break;
    }
  }
}
int mx[maxn], cnt[maxn], p[maxn];
long long ans = 1;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  sort(p + 1, p + 1 + n);
  getP(p[n]);
  for (int i = n; i >= 1; i--) {
    if (!mx[p[i]])
      mx[p[i]] = 1, cnt[p[i]] = 1, ans = ans * p[i] % P;
    else {
      int t = --p[i];
      while (t > 1) {
        int d = mp[t], k = 0;
        while (t % d == 0) k++, t /= d;
        if (mx[d] < k) {
          for (int j = mx[d] + 1; j <= k; j++) ans = ans * d % P;
          mx[d] = k;
          cnt[d] = 1;
        } else
          cnt[d] += (k == mx[d]);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    bool pd = false;
    int t = p[i];
    while (t > 1) {
      int d = mp[t], k = 0;
      while (t % d == 0) k++, t /= d;
      if (mx[d] == k && cnt[d] == 1) pd = true;
    }
    if (!pd) {
      ans = (ans + 1) % P;
      break;
    }
  }
  printf("%lld\n", ans);
}
