import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

const long MOD = 1_000_000_007;

void main(){
	int n = readln.chomp.to!int;
	long[] xs = readln.chomp.split.map!(to!long).array;
	
	BigInt ans = BigInt(1);
	
	int count = 0;
	for(int i = 1; i <= n; i ++){
		if(xs[i - 1] < 2 * (i - count) - 1){
			ans *= (i - count);
			ans %= MOD;
			count += 1;
			}
		}
	for(int i = 1; i <= n - count; i ++){
		ans *= i;
		ans %= MOD;
		}
	
	ans.writeln;
	}