#include <functional>
#include <ios>
#include <numeric>
#include <ostream>
#include <string>
#include <valarray>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC target("popcnt")
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include<bits/stdc++.h>
#include <cstdarg>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <math.h>
#include <vector>

// @author : sam000013

#define int long long
#define ll long long
#define PI 3.14159265
#define pb(x) push_back(x)
#define all(v) v.begin(), v.end()   
#define dbg(x) cout<<#x<<" "<<x<<endl;
#define bye cout<<endl;return
#define uni 1.000000
#define ld long double
using namespace std;

const int mod = 1000000007;
const int secondMod = 998244353;
const int hashMod = 29996224275833;
template <typename T>

void show(vector<T> x)
{
    for (auto e : x){
        cout<<e<<" ";
    }
    cout<<endl;
}
template <typename T1>
void showPair(vector<pair<T1, T1>> x) {
    for(auto e:x){
        cout<<e.first<<" "<<e.second<<endl;
    }
}
template <typename T2>
void showSetPair(set<T2> x) {
    for(auto e:x){
        cout<<e.first<<" "<<e.second<<"\n";
    }
    // cout<<endl;
}
template <typename T3>
void showMultiSet(multiset<T3> x) {
    for(auto e:x){
        cout<<e<<" ";
    }
    cout<<endl;
}

/*



*/

void solve(){
    int n;
    cin>>n;
    set<int> s;
    for(int i=0; i<n; i++){
        int x;cin>>x;
        s.insert(x);
    }
    int ans = 1, prev = 0;
    for(auto x:s){
        ans = (ans * (x-prev+1))%mod;
        prev = x;
    }
    cout<<ans;bye;

    
}   
signed main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int t   = 1;
    // cin >> t;
    for(int i=1; i<=t; i++){
        solve();
    }
    return 0;
}
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    lli n;cin>>n;
    vlli a(n);flli(i,0,n-1)cin>>a[i];
    sort(all(a));
    lli val=(a[0]+1)%mod;
   	flli(i,1,n-1)
   	{
   		val=(val*(a[i]-a[i-1]+1))%mod;
   	}
   	cout<<val;
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}