#include #define ll long long typedef unsigned long long int ull; using namespace std; #define mx 100005 ll ar[mx]; ll mod ,c[1205][1205],n,dp[1205][1205]; ll fac[1205]; void ncr() { int i,r; fac[0] = 1; fac[1] = 1; for(i=2;i<=1203;i++) fac[i] = (fac[i-1]*i)%mod; for(i=0;i<=1203;i++) { for(r=0;r<=1203;r++) dp[i][r] = -1; } for(i=0;i<=1203;i++) { for(r=0;r<=1203 && r<=i;r++) { if(r==0 || r==i) c[i][r] = 1; else { c[i][r] = (c[i-1][r-1] + c[i-1][r])%mod; } } } } ll go(int pos,int last) { if(pos>n) { return 1; } if(dp[pos][last]!=-1) return dp[pos][last]; ll r = 0,pre,tmp; int i; pre = -1; for(i=1;i<=last;i++) { if(pos==1) { if(ar[pos+i-1]n) break; } } return dp[pos][last] = r; } int main() { mod = 1e9+7; ncr(); int i; scanf("%lld",&n); for(i=1;i<=n;i++) scanf("%lld",&ar[i]); cout<