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

const int MOD = 1e9 + 7;

int32_t main(){

	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	int n;
	cin>>n;

	set<int> s;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		s.insert(x);
	}

	int prev = 0;
	int ans = 1;

	for(int i : s){
		int extra = i - prev + 1;
		ans = (ans*extra)%MOD;
		prev = i;
	}

	cout<<ans<<"\n";


	return 0;
}
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
// warning: pragmas don't work on USACO and just set to O0

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //gp_hash_table<T, U, chash>;
#include <ext/pb_ds/tree_policy.hpp>     //tree<T, U, cmp, rb_tree_tag,tree_order_statistics_node_update>;
using namespace std; using namespace __gnu_pbds;
// shorter template (CF specialization, because compile time better)

inline int RAND(int l, int r) {
    mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> unifd(l, r); return unifd(mt);
}

template <class T> using pq = priority_queue<T, vector<T>, greater<T>>;
using ll = long long; using db = double; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; 
using vll = vector<ll>; const int xd[4] = {0, 1, 0, -1}, yd[4] = {1, 0, -1, 0};

#define ff first
#define ss second
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define pf push_front

//#define TC
const ll INF = 1e18; const db EPS = 1e-8;
const int MOD = 1e9 + 7, // 998244353
    _ = 2e5 + 5;

void solve() {
    int n;
    cin>>n;
    vll a(n);
    for(int i=0;i<n;i++) {
        cin>>a[i];
    }
    sort(all(a));
    ll ans = 1;
    for(int i=1;i<n;i++) {
        ll res = (a[i]-a[i-1]+1);
        ans *= res;
        ans%=MOD;
    }

    ans *= (a[0]+1);
    ans%=MOD;
    cout<<ans;
    
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    cin.tie(0)->sync_with_stdio(0); //cout << setprecision(3) << fixed << showpoint;
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}