#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 1;
const long long M = 1e9 + 7;
int n, a[N], f[N], cnt[N];
vector<pair<int, int> > fac[N];
bool used[N], vis[N];
void init() {
  for (int i = 2; i < N; i++) {
    if (vis[i]) continue;
    fac[i].push_back(pair<int, int>(i, 1));
    for (int j = i + i; j < N; j += i) {
      vis[j] = 1;
      if (used[j]) {
        int c = 0, x = j;
        while (x % i == 0) {
          c++;
          x /= i;
        }
        fac[j].push_back(pair<int, int>(i, c));
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    used[a[i] - 1] = 1;
  }
  init();
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    int x = a[i];
    if (f[x]) a[i] = --x;
    for (int j = 0; j < fac[x].size(); j++) {
      pair<int, int> p = fac[x][j];
      int y = p.first;
      if (p.second > f[y])
        f[y] = p.second, cnt[y] = 1;
      else if (p.second == f[y])
        cnt[y]++;
    }
  }
  bool ok = 0;
  for (int i = 0; i < n; i++) {
    int x = a[i];
    bool g = 1;
    for (int j = 0; j < fac[x].size(); j++) {
      pair<int, int> p = fac[x][j];
      int y = p.first;
      if (p.second == f[y] && cnt[y] == 1) {
        g = 0;
        break;
      }
    }
    if (g) {
      ok = 1;
      break;
    }
  }
  long long ans = 1;
  for (int i = 2; i < N; i++) {
    while (f[i]) {
      ans = ans * i % M;
      f[i]--;
    }
  }
  if (ok) ans++, ans %= M;
  printf("%lld\n", ans);
}
