#include<bits/stdc++.h>
#define int long long
using namespace std;
#define pr pair<int,int>
#define vect vector <int> v1
#define pb push_back
#define sortv sort(v1.begin(),v1.end());
#define loop(i,a,b)  for(int i=(a);i<(b);i++)
#define inputarr loop(i,0,n) cin>>ar[i];
const int mod=1e9+7;
int calpowof2(int a, int b)
{
    if(b==0)
    return 1;
    if(b%2==0)
    {
        int ans=calpowof2(a,b/2);
        return (ans%mod*ans%mod)%mod;
    }
    
        int ans=calpowof2(a,b-1);
        return (a%mod*ans%mod)%mod;
}
void solve()
{
  int i,j,n,t,m,k,ct=0,sum=0,flag=0;
   cin>>n;
   set<int> s;
   s.insert(0);
   loop(i,0,n)
   {
       cin>>j;
       s.insert(j);
   }
   sum=1;
   for(auto it=s.begin();it!=s.end();it++)
   {
       ct++;
       if(ct==s.size())
       {
           break;
       }
       auto it1=next(it,1);
       sum=sum*((*it1-*it+1)%mod)%mod;
   }
   cout<<sum;
}
signed main()
{
//freopen("lineup.in","r",stdin); 
//freopen("lineup.out","w",stdout); 
ios::sync_with_stdio(false); 
cin.tie(NULL); 
// WATCH FOR SAME VARIABLE USAGE CLEARLY!!! 
// AFTER WA VERDICT CHECK FIRSTLY YOUR WHOLE CODE AND THEN MOVE ON TO LOGIC ERROR
//MAKE SURE TO MAKE A DUPLICATE OF ANYTHING IF PERFORMING OPERATION DIRECTLY ON SOMETHING !!! 
int t=1;
//cin>>t;
while(t--)
{
  solve();
}

cerr<< endl << clock() * 1000.0 / CLOCKS_PER_SEC <<'m'<<'s';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll mod=1e9+7;

int main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    for(int i=0;i<N;i++) cin>>A[i];
    sort(A.begin(),A.end());
    ll ans=A[0]+1;
    map<ll,bool> seen;
    seen[A[0]]=true;
    for(int i=1;i<N;i++){
        if(seen[A[i]]) continue;
        ans*=(A[i]-A[i-1]+1);
        ans%=mod;
        seen[A[i]]=true;
    }
    cout<<ans<<endl;
    return 0;
}