#include<algorithm>
#include<cstdio>
#define ll long long
#define MaxN 200500
using namespace std;
const int mod=1000000007;
int n,a[MaxN];
int main()
{
  scanf("%d",&n);
  for (int i=1;i<=n;i++)scanf("%d",&a[i]);
  sort(a+1,a+n+1);
  ll ans=1;
  for (int i=1;i<=n;i++)
    ans=(ans*(a[i]-a[i-1]+1))%mod;
  printf("%lld",ans);
  return 0;
}
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
#define per(i, x, y) for (int i = x; i >= y; i--)
#define vi vector<int>
#define Go(i, x, v) for (int i = 0, x = (i == v.size() ? 0 : v[i]); i < v.size(); i++, x = (i == v.size() ? 0 : v[i]))
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define gc getchar
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
template <class T> void rd(T &x) {
  x = 0; char ch = gc(); int f = 1;
  for (; !isdigit(ch); ch = gc()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = gc()) x = (x << 1) + (x << 3) + ch - '0';
  x *= f;
}
template <class T> void cmin(T &x, T y) { x = min(x, y); }
template <class T> void cmax(T &x, T y) { x = max(x, y); }
const int mod = 1e9 + 7;
void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
void Sub(int &x, int y) { x += mod - y; if (x >= mod) x -= mod; }
void Mul(int &x, int y) { x = (ll)x * y % mod; }
int add(int x, int y) { x += y; if (x >= mod) x -= mod; return x; }
int sub(int x, int y) { x += mod - y; if (x >= mod) x -= mod; return x; }
int mul(int x, int y) { return (ll)x * y % mod; }
int qpow(int a, int b) { int ret = 1; for (; b; b >>= 1, Mul(a, a)) if (b & 1) Mul(ret, a); return ret; }
/* ============ Header Template ============ */

const int N = 1e5 + 10;
int n, a[N], b[N], tot;

int main() {
  rd(n);
  rep(i, 1, n) {
    rd(a[i]);
    b[i] = a[i];
  }
  sort(b + 1, b + n + 1);
  tot = unique(b + 1, b + n + 1) - b - 1;
  int ans = 1;
  rep(i, 1, tot) {
    Mul(ans, max(1, b[i] - b[i - 1] + 1));
  }
  printf("%d\n", ans);
  return 0;
}