#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int mul (int a, int b) { return 1ll * a * b % MOD; }
int main() {
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	a.push_back(0);
	sort(a.begin(), a.end());
	int ans = 1;
	for (int i = 1; i <= n; i++) {
		ans = mul(ans, a[i] - a[i - 1] + 1);
	}
	printf("%d\n", ans);
	return 0;
}
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = s; i < (n); i++)

const ll MOD = 1000000007;
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  ll ans = 1;
  rep(i, n){
    if (i == 0)
      ans *= (a[i] + 1);
    else{
      ll diff = a[i] - a[i-1];
      if (diff == 0) continue;
      ans *= (diff + 1);
    }
    ans %= MOD;
  }
  cout << ans << endl;
  
  return 0;
}