#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int mx[2020202], cnt[2020202];
bool mk[202020];
int p[202020];
bool cmp(const int &x, const int &y) { return x > y; }
int main() {
  int n, pp, now, ans = 1;
  bool ok;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  sort(p + 1, p + 1 + n, cmp);
  for (int i = 1; i <= 2000000; i++) {
    mx[i] = 1;
    cnt[i] = 0;
  }
  memset(mk, 0, sizeof(mk));
  for (int i = 1; i <= n; i++) {
    if (mx[p[i]] == 1) {
      mx[p[i]] = p[i];
      cnt[p[i]] = 1;
      mk[i] = true;
      continue;
    }
    pp = p[i] - 1;
    for (int j = 2; j * j <= pp; j++)
      if (pp % j == 0) {
        now = 1;
        while (pp % j == 0) {
          now *= j;
          pp /= j;
        }
        if (now > mx[j]) {
          mx[j] = now;
          cnt[j] = 1;
        } else if (now == mx[j])
          cnt[j]++;
      }
    if (pp != 1) {
      if (pp > mx[pp]) {
        mx[pp] = pp;
        cnt[pp] = 1;
      } else if (pp == mx[pp])
        cnt[pp]++;
    }
  }
  for (int i = 1; i <= 2000000; i++) ans = (long long)ans * mx[i] % mod;
  for (int i = 1; i <= n; i++)
    if (!mk[i]) {
      pp = p[i] - 1;
      ok = true;
      for (int j = 2; j * j <= pp; j++)
        if (pp % j == 0) {
          now = 1;
          while (pp % j == 0) {
            now *= j;
            pp /= j;
          }
          if (now == mx[j] && cnt[j] == 1) ok = false;
        }
      if (pp != 1 && mx[pp] == pp && cnt[pp] == 1) ok = false;
      if (ok) {
        ans = (ans + 1) % mod;
        break;
      }
    }
  printf("%d", ans);
  return 0;
}
