

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<set>
using namespace std;

#define  ll             long long int
#define  ull            unsigned long long int
#define  ld             long double
#define  max3(a,b,c)    max(a,max(b,c))
#define  max4(a,b,c,d)  max(max3(a,b,c),d)
#define  min3(a,b,c)    min(a,min(b,c))
#define  min4(a,b,c,d)  min(min3(a,b,c),d)
vector<ll> v,w;
set<ll>s1;
map<ll,ll>mp;

long long mod = 1000000007;
int main()
{
  ll i,j=0,l,m,n,o,r,t,x,y,k,c=1;
  string s,p,q;
cin>>n;
ll a[n+1]={0};
for(i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+n+1);
for(i=1;i<=n;i++){
c*=(a[i]-a[i-1]+1);
c%=mod;
}
cout<<c;
}
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3fll
typedef unsigned long long ull;
typedef long long ll;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define nep(i,r,l) for(int i=r;i>=l;i--)
void sc(int &x){scanf("%d",&x);}
void sc(int &x,int &y){scanf("%d%d",&x,&y);}
void sc(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sc(ll &x){scanf("%lld",&x);}
void sc(ll &x,ll &y){scanf("%lld%lld",&x,&y);}
void sc(ll &x,ll &y,ll &z){scanf("%lld%lld%lld",&x,&y,&z);}
void sc(char *x){scanf("%s",x);}
void sc(char *x,char *y){scanf("%s%s",x,y);}
void sc(char *x,char *y,char *z){scanf("%s%s%s",x,y,z);}
void out(int x){printf("%d\n",x);}
void out(ll x){printf("%lld\n",x);}
void out(int x,int y){printf("%d %d\n",x,y);}
void out(ll x,ll y){printf("%lld %lld\n",x,y);}
void out(int x,int y,int z){printf("%d %d %d\n",x,y,z);}
void out(ll x,ll y,ll z){printf("%lld %lld %lld\n",x,y,z);}
using namespace std;
const int N=3e5+5,mod=1e9+7;
int n,a[N];
int main()
{
    //freopen("1.in","r",stdin);freopen("1.out","w",stdout);
    sc(n);
    rep(i,1,n) sc(a[i]);
    sort(a+1,a+1+n);
    ll ans=a[1]+1;
    rep(i,1,n-1)
        ans=ans*(a[i+1]-a[i]+1)%mod;
    out(ans);
}
