#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define all(x)                      (x).begin(),(x).end()
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << ": " <<  x << endl;

const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

int n;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	set<int> st;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		st.insert(x);
	}

	ll ans = 1, prv = 0;
	while (!st.empty()) {
		int x = *st.begin();
		ans = ans * (x - prv + 1) % MOD;
		st.erase(st.begin());
		prv = x;
	}

	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int mod=1000000007,inv2=(mod+1)/2;
int n,a[100010];
LL ans=1;
inline int read()
{
	int x=0;bool w=0;char ch=0;
	while(!isdigit(ch)){w|=ch=='-';ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return w?-x:x;
}
LL ksm(LL B,LL K,LL A=1)
{
	for(;K;K>>=1,B=B*B%mod)
	if(K&1)A=A*B%mod;
	return A;
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	sort(a+1,a+1+n);
	n=unique(a+1,a+1+n)-a-1;
	for(int i=1;i<=n;i++)
		ans=ans*(1+a[i]-a[i-1])%mod;
	printf("%lld\n",ans);
	return 0;
}