#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 6;
const int mod = 1e9 + 7;
int a[N], dif[N];
signed main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	a[0] = 0;
	for(int i = 1; i <= n; i++) {
		dif[i - 1] = a[i] - a[i - 1] + 1;
	}
	int ans = 1;
	for(int i = 0; i < n; i++) {
		ans = (ans * dif[i]) % mod;
	}
	cout << ans;
}
/***************************************************************
	File name: B.cpp
	Author: ljfcnyali
	Create time: 2021年04月18日 星期日 20时03分40秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
#define pii pair<int, int>
#define int long long
typedef long long LL;

const int maxn = 1e5 + 10;
const int Mod = 1e9 + 7;

int n, ans = 1;
map<int, bool> Map;

signed main()
{
	scanf("%lld", &n);
	REP(i, 1, n) { int x; scanf("%lld", &x); Map[x] = true; }
	int lst = 0;
	for ( auto it : Map ) { ans = ans * (it.first - lst + 1) % Mod; lst = it.first; }
	printf("%lld\n", ans);
    return 0;
}
