#include<bits/stdc++.h>
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for(i = 0; i < n; i++){
            cin >> v[i];
        }
        sort(v.begin(), v.end());
        ll ans = v[0] + 1;
        for(i = 1; i < n; i++){
            ans *= (v[i] - v[i - 1] + 1);
            ans %= MOD;
        }
        cout << ans << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD=1000000007;

int main(){
    int N;cin>>N;
    vector<ll>A;
    A.push_back(0);
    set<ll>B;
    ll tmp;
    rep(i,N){
        cin>>tmp;
        if(B.find(tmp)!=B.end())continue;
        B.insert(tmp);
        A.push_back(tmp);
    }
    sort(A.begin(),A.end());
    ll ans=1;
    rep(i,A.size()-1){
        ans*=(A[i+1]-A[i]+1);
        ans%=MOD;
        //cout<<ans<<"\n";
    }
    cout<<ans;
    return 0;
}