#include <bits/stdc++.h>
using namespace std;
//ofstream cout("output.out");

#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define pb push_back
#define vi vector<int>
#define vl vector<ll>					
#define vii vector<vector<int>>
#define mii map<int, int>
#define pii pair<int, int>
#define qii priority_que<int, vector<int>, greater<int>>				
#define For(i, n) for(int i = 0; i < n; ++i)
#define For1(i, n) for(int i = 1; i <= n; ++i)
#define Forlr(i, l, r) for(int i = l; i <= r; ++i)
#define Forrl(i, r, l) for(int i = r; i >= l; --i)
#define o(a) { cout << #a << ":" << (a) <<" ";}
#define ov(a) {For(i, a.size()) cout << a[i] <<" ";}
#define ovv(a) {For(i, a.size()) {For(j, a[i].size()) cout << a[i][j] <<" ";cout <<"\n";}}
using ll = long long;
int n, m, k, q;
const ll INF = 1e18 + 5;
const int nax = 1e5 + 5;
const ll mod = 1e9 + 7;
void solve(){
	cin >> n;
	vl a(n);
	For(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	auto it  = unique(a.begin(), a.end());
	a.resize(distance(a.begin(), it));
	//For(i, a.size()) cout << a[i] <<" ";
	ll rs = 1ll;
	ll pr = 0;
	For(i, a.size()){
		rs = rs * (a[i] - pr + 1ll) % mod;
		pr = a[i];
	}
	//rs = rs * 2 ;
	cout << rs <<"\n";
}
int main ()
{
	fast();
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
  	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

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

const int N=1e6+5,mod=1e9+7;
int n,a[N];
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    long long ans=1;
    for(int i=n-1;~i;i--) ans*=(a[i+1]-a[i]+1),ans%=(mod);
    cout<<ans;
}
