#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int mod = 1e9 + 7;
inline int add(int a, int b) {
return a+b >= mod ? a+b-mod : a+b;
}
inline int sub(int a, int b) {
return a >= b ? a-b : a-b+mod;
}
inline int mul(int a, int b) {
return llint(a)*b % mod;
}
int main(void) {
int n;
scanf("%d", &n);
int c = 0;
int ans = 1;
REP(i, n) {
int x;
scanf("%d", &x);
if (c == 0) {
c++;
} else {
if (x == 2*c) {
ans = mul(ans, c+1);
} else {
c++;
}
}
}
REP(i, c) ans = mul(ans, i+1);
printf("%d\n", ans);
return 0;
}