// Problem: B - ARC Wrecker
// Contest: AtCoder - AtCoder Regular Contest 117
// URL: https://atcoder.jp/contests/arc117/tasks/arc117_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<ll>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rnd(x, y) uniform_ll_distribution<ll>(x, y)(rng)

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif

const ll max_n = 1e5 + 9;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	ll n;
	cin >> n;
	vector<ll> a(n);
	for(ll i = 0 ; i < n ; i++) {
		cin >> a[i];
	}
	
	sort(all(a));
	ll prod = (a[0] + 1);
	for(ll i = 1 ; i < n ; i++) {
		prod *= (a[i] - a[i-1] + 1);
		prod %= mod;
	}
	
	cout << prod << "\n";
}
signed main(){
	ll t = 1;
	// cin >> t;
	for(ll i = 1 ; i <= t ; i++){
		solve();
	}
}

#include<bits/stdc++.h>
using namespace std;

#define INF 1234567890
#define ll long long
#define MOD 1000000007

int T;
int N;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	cin >> N;
	vector<int> A(N);
	for(int i=0; i<N; i++)
		cin >> A[i];
	A.push_back(0);
	sort(A.begin(), A.end());
	A.erase(unique(A.begin(), A.end()), A.end());
	N = A.size();

	ll res = 1;
	for(int i=1; i<N; i++)
	{
		res *= A[i]-A[i-1]+1;
		res %= MOD;
	}
	cout << res << "\n";
	return 0;
}