#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000005;
const long long MOD = 1000000007;
int P[200005];
int pfac[MAXN], has[MAXN], tot[MAXN];
vector<pair<int, int>> contrib[200005];
int main() {
  for (int i = 2; i < MAXN; ++i) pfac[i] = i;
  for (int i = 2; i < MAXN; ++i)
    if (pfac[i] == i) {
      for (int j = i + i; j < MAXN; j += i) pfac[j] = i;
    }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &P[i]);
  sort(P, P + n);
  long long ans = 1;
  for (int i = n - 1; i >= 0; --i) {
    if (has[P[i]]) {
      int x = P[i] - 1;
      while (x > 1) {
        int p = pfac[x];
        int cnt = 0;
        while (x % p == 0) {
          x /= p;
          ++cnt;
        }
        if (has[p] < cnt) tot[p] = 0;
        contrib[i].push_back({p, cnt});
        while (has[p] < cnt) {
          ++has[p];
          ans = ans * p % MOD;
        }
        if (has[p] == cnt) ++tot[p];
      }
    } else {
      tot[P[i]] = 1;
      contrib[i].push_back({P[i], 1});
      has[P[i]] = 1;
      ans = ans * P[i] % MOD;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    bool bad = false;
    for (auto x : contrib[i]) {
      if (x.second == has[x.first]) {
        if (tot[x.first] == 1) bad = true;
      }
    }
    if (!bad) {
      ++ans;
      break;
    }
  }
  ans %= MOD;
  printf("%lld\n", ans);
}
