#include <bits/stdc++.h>
const int N = 2000007, P = 1000000007;
int a[N], low[N], mx[N], num[N], vis[N];
int mul(int a, int b) { return 1ll * a * b % P; }
int pow(int a, int k) {
  int r = 1;
  for (; k; k >>= 1, a = mul(a, a))
    if (k & 1) r = mul(a, r);
  return r;
}
int read() {
  int x = 0, c = getchar();
  while (isspace(c)) c = getchar();
  while (isdigit(c)) (x *= 10) += c & 15, c = getchar();
  return x;
}
void update(int p, int x) {
  if (x > mx[p])
    mx[p] = x, num[p] = 1;
  else
    num[p] += mx[p] == x;
}
int check(int x) {
  for (int p, c; x ^ 1;) {
    for (p = low[x], c = 0; !(x % p); x /= p, ++c)
      ;
    if (c == mx[p] && num[p] == 1) return 0;
  }
  return 1;
}
int main() {
  int n = read(), s = 1, t = 0;
  for (int i = 1; i <= n; ++i) a[i] = read();
  std::sort(a + 1, a + n + 1);
  for (int i = 2; i <= a[n]; ++i)
    if (!low[i])
      for (int j = i; j <= a[n]; j += i)
        if (!low[j]) low[j] = i;
  for (int i = n, v, x, p, c; i; --i)
    if (mx[v = a[i]])
      for (vis[i] = 1, x = v - 1; x ^ 1;
           s = mul(s, pow(p, std::max(0, c - mx[p]))), update(p, c))
        for (p = low[x], c = 0; !(x % p); x /= p, ++c)
          ;
    else
      update(v, 1), s = mul(s, v);
  for (int i = 1; i <= n; ++i)
    if ((vis[i] && check(a[i] - 1)) || (!vis[i] && check(a[i]))) t = 1;
  printf("%d", (s + t) % P);
}
