#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll mod = 1e9+7;

int main(void){
  int n;
  vector<int> a;
  cin >> n;
  for(int i = 0;i < n;++i){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  ll res = 1;
  ll rest = 0;
  for(int i = 0;i < n;++i){
    ++rest;
    if(a[i] < rest*2-1){
      res *= rest;
      res %= mod;
      --rest;
    }
  }
  for(int i = 1;i <= rest;++i){
    res *= i;
    res %= mod;
  }
  cout << res << endl;
  return 0;
}
