#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<bitset>
#include<deque>
#include<cstdlib>
#include<set>
#include<ctime>
#define ll long long
#define mp make_pair
#define mod 1000000007 
using namespace std;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return f*x;
}
int n;
ll a[100003],ans=1;
int main()
{
	n=read();
	for(int i=1;i<=n;++i) a[i]=read();
	sort(a+1,a+1+n);
	for(int i=1;i<=n;++i)
	{
		ans=ans*(a[i]-a[i-1]+1)%mod;
		while(a[i]==a[i+1]) ++i;
	}
	cout<<ans<<'\n';
	return 0;
 }

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;


const int N = 400010, mod = 1e9 + 7;

set<LL> s;
int n;

int main(){
    cin >> n;
    s.insert(0);
    for (int i = 0; i < n; i ++)    {
        int x;
        cin >> x;
        s.insert(x);
    }

    LL ans = 1;

    for (auto it = next(s.begin()), i = s.begin(); it != s.end(); it ++, i ++) {
        ans = ans * (*it - *i + 1) % mod;
    }
    cout << ans;
    return 0;
}
