#include <bits/stdc++.h>
using namespace std;
long long vi[2000010], c[2000010], pr[2000010], mx[2000010], v[2000010], ct, n,
    p[2000010];
void init() {
  for (long long i = 2; i < 2000010; i++) {
    if (!vi[i]) {
      p[++ct] = i;
      pr[i] = i;
    }
    for (long long j = 1; j <= ct && i * p[j] < 2000010; j++) {
      vi[i * p[j]] = 1;
      pr[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
}
signed main() {
  init();
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> v[i];
  long long r = 1;
  sort(v + 1, v + n + 1);
  for (long long i = n; i; i--) {
    if (!c[v[i]]) {
      c[v[i]]++;
      mx[v[i]] = 1;
      r = r * v[i] % 1000000007ll;
    } else {
      v[i]--;
      long long x = v[i];
      while (x ^ 1) {
        long long t = pr[x], ct = 0;
        while (x % t == 0) {
          x /= t;
          ct++;
        }
        if (c[t] < ct) {
          for (long long j = c[t] + 1; j <= ct; j++) r = (r * t) % 1000000007ll;
          c[t] = ct;
          mx[t] = 1;
        } else
          mx[t] += (c[t] == ct);
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long x = v[i], ok = 0;
    while (x ^ 1) {
      long long t = pr[x], ct = 0;
      while (x % t == 0) {
        x /= t;
        ct++;
      }
      if (c[t] == ct && mx[t] == 1) ok = 1;
    }
    if (!ok) {
      r++;
      break;
    }
  }
  cout << r;
}
