#include<bits/stdc++.h>
using namespace std;
int a[200000];
long long b[200000];
int Mod=1e9+7;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n);
	int tot=0;
	for(int i=1;i<=n;i++)
		if(a[i]!=a[i-1]) b[++tot]=a[i]; 
	long long sum=1;
	for(int i=1;i<=tot;i++)
	{
		sum=sum*(b[i]-b[i-1]+1)%Mod;
	}
	cout<<sum;
	return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FOREACH(a, b) for (auto &(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define dbg(x) cout << (#x) << " is " << (x) << endl;
#define dbg2(x, y) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << y << endl;
#define dbgarr(x, sz)                                             \
  for (int asdf = 0; asdf < (sz); asdf++) cout << x[asdf] << ' '; \
  cout << endl;
#define dbgarr2(x, rose, colin)                \
  for (int asdf2 = 0; asdf2 < rose; asdf2++) { \
    dbgarr(x[asdf2], colin);                   \
  }
#define dbgitem(x)                                                           \
  for (auto asdf = x.begin(); asdf != x.end(); asdf++) cout << *asdf << ' '; \
  cout << endl;

const int mod = 1e9 + 7, MAXN = 1e5 + 1;

int n, A[MAXN];
struct Solution {
  int solve() {
    sort(A, A + n);
    auto it = unique(A, A + n);
    n = it - A;
    long res = 1;
    REP(i, n) {
      res = (res * (A[i] - (i ? A[i - 1] : 0) + 1)) % mod;
    }
    return res;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution test;
  string s;
  cin >> n;
  REP(i, n)
  cin >> A[i];
  cout << test.solve() << endl;
}