#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 5005, inf = 1e9;
#define fi first
#define se second
int mod = 1e9 + 7;
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    int n;
    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());
    ll ans = 1;
    for (int i = n; i > 0; i--){
        ans *= a[i] - a[i - 1] + 1;
        ans %= mod;
    }
    cout << ans;
}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i,j,n) for(long long i = j ; i < n ; ++i) 
#define fr(i,j,n) for(long long i = j ; i >= n ; --i)
#define ones(x) __builtin_popcount(x)
#define endl '\n'
#define sz(v) v.size()
 
using namespace std;
//using namespace __gnu_pbds;
typedef long long  ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef deque<int> di;
typedef deque<long long> dll;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vpll;
/*typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
const ll N = 2e5 + 100;
const ll M = 1e5 + 100;
const ll inf = 9e18;
const ll mod = 1e9 + 7;
ll n,a[N];
 
ll mul(ll x,ll y){
	return (x*y)%mod;
}
 
void solve(){
	cin >> n;
	a[0] = 0;
	f(i,1,n+1) cin >> a[i];
	sort(a+1,a+n+1);
	ll ans = 1;
	f(i,0,n) ans = mul(ans,a[i+1]-a[i]+1);
	cout << ans << endl;
}	
 
int main(){
	fastio;
	ll tc = 1;
	// cin >> tc;
	while(tc--) solve();
	return 0;
}