#include<cstdio>
const int inf=1e9+7;
typedef long long ll;
ll a[100005];
ll fac[100005];
void init()
{
	fac[0]=1;
	for(int i=1;i<100005;i++)
		fac[i]=fac[i-1]*i%inf;
}
int main ()
{
	//freopen("in.txt","r",stdin);
	init();
	int n,k=0;
	ll sum=1,cur=1;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int c;
		scanf("%d",&c);
		if(cur<=c)
			cur+=2;
		else
		{
			sum*=i;
			k++;
		}
	}
	sum=sum*fac[n-k]%inf;
	printf("%I64d\n",sum);

}