#include <bits/stdc++.h>
using namespace std;
const long nPrime = 1000000007;
//const long nPrime = 998244353;
int main() {
    long n;
    cin >> n;
    vector<long> viNum(n);
    for(long i = 0; i < n; i++){
        cin >> viNum[i];
    }
    viNum.push_back(0);
    sort(viNum.rbegin(), viNum.rend());
    long nAns = 1;
    for(long i = 0; i < n; i++){
        nAns *= (viNum[i] - viNum[i+1] + 1);
        nAns %= nPrime;
    }
    cout << nAns << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define stp(var, init, end) for (auto var = init; var < end; ++var)
#define stpe(var, init, end) for (auto var = init; var <= end; ++var)
#define ll long long

#define MOD 1000000007
int main(void)
{
    int n;
    cin >> n;
    set<int> bui;
    int a;
    stp(i, 0, n)
    {
        cin >> a;
        bui.insert(a);
    }

    int bef = 0;
    ll out = 1;
    for (auto iter = bui.begin(); iter != bui.end(); ++iter)
    {
        out = (out * (*iter - bef + 1)) % MOD;
        bef = *iter;
    }
    cout << out;
    return 0;
}