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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<ll> vl;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)size(x)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

string to_string(char c) {
  return string(1, c);
}
string to_string(bool b) {
  return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) { 
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) { 
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
const ll mod=1e9+7;

//-------------------####Real Programming###------------------

void solve(){
  ll n; cin>>n; ll a[1 << 18], g[1 << 18]; ll ans=1;
  FOR(i,1,n+1) cin>>a[i];
  sort(a+1,a+n+1);
  FOR(i,1,n+1) g[i]=(a[i]-a[i-1]);
  FOR(i,1,n+1) {ans*=(g[i]+1); ans%=mod;}
  cout<<ans<<"\n";
  return;
}
int main() {
  //freopen("blocks.in", "r", stdin);
  //freopen("blocks.out", "w", stdout); 
  ios::sync_with_stdio(0);
	cin.tie(0);

  //int t; cin>>t;
  //F0R(i,t){
    //write("Case #", i+1, ": ");
  solve();
  //}
  return 0;
}
///Bismillahir Rahmanir Rahim
/*
    Author: Tanzin Ahammad
*/
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        gcd(a,b)        __gcd(a,b)
#define        lcm(a,b)        (a*b)/gcd(a,b)
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((ll)(v).size())
#define        mem(a,b)        memset(a, b, sizeof(a))
#define        uniq(v)         (v).erase(unique(all(v)),(v).end())
#define        mchk(mask,pos)  (mask & (1ll<<pos))
#define        mset(mask,pos)  (mask bitor (1ll<<pos))
#define        munset(mask,pos) (mask ^ (1ll<<pos))
#define        print_case      cout<<"Case "<<cs<<": "
#define        sumt(a,b)       ((a%mod)+(b%mod))%mod
#define        subt(a,b)       ((a%mod)-(b%mod)+mod)%mod
#define        mult(a,b)       ((a%mod)*(b%mod))%mod
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
const int N = 1e6+5;
const int mod = (int)  1e9 + 7;
ll arr[N];



int main()
{
    IOS;

    ll tc,n,x,i,j;
    cin>>n;
    for(i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    ll mul=1;x=0;
    for(i=0;i<n;i++)
    {
           mul=mult(mul,arr[i]-x+1);
           x=arr[i];
    }
    cout<<mul<<endl;


    return 0;
}
