#include <iostream>

using namespace std;

const long long mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    long long a;
    long long cnt = 0;
    long long ans = 1;
    for (int i = 0 ; i < n; ++i) {
        cin >> a;
        ++cnt;
        if (a < cnt * 2 - 1) {
            ans = (ans * cnt) % mod;
            --cnt;
        }
    }
    for (long long i = 1; i <= cnt; ++i) {
        ans = (ans * i) % mod;
    }
    cout << ans << endl;
    return 0;
}
