#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	bool flag=1;
	int x=0;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
			flag=0;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return (flag?x:~(x-1));
}
set<int> s;
int n,a,ans=1;
const int mod=1e9+7;
signed main()
{
	n=read();
	while(n--)
		s.insert(read());
	s.insert(0);
	for(auto a=++s.begin(),b=s.begin();a!=s.end();a++,b++)
	{
		(ans*=(1+*a-*b))%=mod;
	}
	cout<<ans;
	return 0;
}

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

using ll = long long;

#define fi first
#define se second

const int N = 2e5 + 5;
const int INF = 2e9;
const ll LINF = 9e18;

const int MOD = 1e9 + 7;

int n;
int a[N], dp[N];

int add(int x, int y) { return (x + 0ll + y) % MOD; }
int mul(int x, int y) { return x * 1ll * y % MOD; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);

  int ans = 1;
  for(int i = 1; i <= n; i++) {
    ans = mul(ans, a[i] - a[i - 1] + 1);
  }

  cout << ans << "\n";
}