import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    immutable long MOD = 10^^9 + 7;
    long ans = 1;
    long pos = 1;
    long cnt = 0;

    foreach (i; 0..N) {
        if (A[i] >= pos) {
            cnt += 1;
            pos += 2;
        } else {
            ans = ans * (cnt + 1) % MOD;
        }
    }

    while (cnt) {
        ans = ans * cnt % MOD;
        cnt -= 1;
    }

    ans.writeln;
}