//***********************************************************//
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define forr(i,a,n)  for(ll i=a;i<n;i++)
#define forrr(i,a,n) for(ll i=a;i<=n;i++)
#define bp(n) __builtin_popcount(n)   // prints one's in binary representation
#define w(t)  int t;cin>>t;while(t--)
#define lc "\n"
#define men(a) (*min_element(a.begin(), a.end()))
#define mex(a) (*max_element(a.begin(), a.end()))
#define deb(x) cout << #x << " " << x << endl ;
#define all(x) x.begin(), x.end()
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
const ll  MOD =1e9+7;
const ll INF = 1e18;
const int N = 100001;
//*********************************************************//

void solve()
{
   ll n ;
   cin >> n ;
   vector<ll>v(n) ; 
   multiset < int > s ;
   forr(i,0,n){
       cin >> v[i] ;
       s.insert( v[i] ) ; 
   }
   ll ans = 1 ;
   int c = 0 ;
   ll prev = 0 ;
   for(auto i : s ){
           
           if(c == 0 ){
               ll  y = i - 0 + 1 ; 
               ans = (ans%MOD)*y ;
               prev = i ; 
               c++;
           }
           else{
                
               ans = ((ans)%MOD)*(i - prev + 1) ; 
               prev = i ;
           } 
   }
   cout << (ans)%MOD << endl ;
  
}


int main()
{

IOS;
//w(t)
{solve();}
// end_routine();
return 0;
 }


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 1e9;
const ll INF2 = 1e18;
const double PI = 3.141592653589793;
 
int main() {
    const int div = 1e9 + 7;

    int n;
    ll ans = 1;
    cin >> n;

    vector<int> A(n, 0);
    vector<int> B(n, 0);
    for(int i = 0; i < n; i++){
        cin >> A.at(i);
    }

    sort(A.begin(), A.end());
    B.at(0) = A.at(0);
    for(int i = 1; i < n; i++){
        B[i] = A[i] - A[i-1];
    }

    for(int b: B){
        ans *= b+1;
        ans %= div;
    }
    cout << ans << endl;
}