#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    int n;
    long long ans,l[100010],t;
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%lld",&l[i]);
        if(l[n-1]>=n-1)
            printf("1\n");
        else
        {
            t=0,ans=0;
            for(int i=n-1;i>=0;i--)
            {
                if(t==0)
                    ans++;
                t=max(l[i],t-1);
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    int n,t;
    long long ans,l[1000010];
    while(scanf("%d",&n)!=EOF)
    {
        memset(l,0,sizeof(l));
        ans=n;
        for(int i=0;i<n;i++)
            scanf("%lld",&l[i]);
        if(l[n-1]>=n-1)
            printf("1\n");
        else
        {
            t=0;
            for(int i=1;i<n;i++)
            {
                t++;
                if(l[i])
                {
                    if(l[i]>t)
                        ans=ans-t;
                    else
                        ans=ans-l[i];
                    t=0;
                }
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    int n,t;
    long long ans,l[1000010];
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%lld",&l[i]);
        if(l[n-1]>=n-1)
            printf("1\n");
        else
        {
            t=0,ans=0;
            for(int i=n-1;i>0;i--)
            {
                if(t==0)
                    ans++;
                t=max(l[i],t-1);
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    int n,t;
    long long ans,l[100010];
    while(scanf("%d",&n)!=EOF)
    {
        memset(l,0,sizeof(l));
        ans=n;
        for(int i=0;i<n;i++)
            scanf("%lld",&l[i]);
        if(l[n-1]>=n-1)
            printf("1\n");
        else
        {
            t=0;
            for(int i=1;i<n;i++)
            {
                t++;
                if(l[i])
                {
                    if(l[i]>t)
                        ans=ans-t;
                    else
                        ans=ans-l[i];
                    t=0;
                }
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    int n;
    long long ans,l[1000010],t;
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=0;i<n;i++)
            scanf("%lld",&l[i]);
        if(l[n-1]>=n-1)
            printf("1\n");
        else
        {
            t=0,ans=0;
            for(int i=n-1;i>=0;i--)
            {
                if(t==0)
                    ans++;
                t=max(l[i],t-1);
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int N;
    cin>>N;
    int A[N];
    for(int i=0;i<N;i++)
        cin>>A[i];
    int i=N-1,j=N;
    int Ans=0;
    while(j>0 && i>=0)
    {
        if(j>i)
            Ans++;
        if(i-A[i]<j)
            j=i-A[i];
        i--;
    }
    cout<<Ans;
}


#include<iostream>
using namespace std;
int main()
{

    long long N;
    cin>>N;
    long long A[N];
    for(int i=0;i<N;i++)
        cin>>A[i];
    long long i=N-1,j=N;
    long long Ans=0;
    while(j>0 && i>=0)
    {
        if(j>i)
            Ans++;
        if(i-A[i]<j)
            j=i-A[i];
        i--;
    }
    cout<<Ans;
}


#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long N;
    int x=0;
    cin>>N;
    long long A[N];
    for(int i=0;i<N;i++)
        cin>>A[i];
    long long i=N-1,j=N;
    long long Ans=0;
    while(j>0 && i>=0)
    {
        if(j>i)
            Ans++;
        if(i-A[i]<j)
            j=i-A[i];
        i--;
    }
    cout<<Ans;
}


#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long N;
    cin>>N;
    long long A[N];
    for(int i=0;i<N;i++)
        cin>>A[i];
    long long i=N-1,j=N;
    long long Ans=0;
    while(j>0 && i>=0)
    {
        if(j>i)
            Ans++;
        if(i-A[i]<j)
            j=i-A[i];
        i--;
    }
    cout<<Ans;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
set<int> st;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]--;
		PS[max(i-a[i],1ll)]++;
		if(a[i]==inf)m++;
	}
	cev=n;
	FOR{
		PS[i]+=PS[i-1];
		if(PS[i]>0)cev--;
	}
	if(n==100000){printf("%lld %lld\n",m,PS[n]);}
	printf("%lld\n",cev);
	return 0;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 1000005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
set<int> st;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]--;
		PS[max(i-a[i],1ll)]++;
		if(a[i]==inf)m++;
	}
	cev=n;
	FOR{
		PS[i]+=PS[i-1];
		if(PS[i]>0)cev--;
	}
	//~ if(n==100000){printf("%lld %lld\n",m,PS[n]);}
	printf("%lld\n",cev);
	return 0;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
set<int> st;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]--;
		PS[max(i-a[i],0ll)]++;
	}
	cev=n;
	FOR{
		PS[i]+=PS[i-1];
		if(PS[i]>0)cev--;
	}
	printf("%lld\n",cev);
	return 0;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 1000005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
set<int> st;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]--;
		PS[max(i-a[i],1ll)]++;
		if(a[i]==inf)m++;
	}
	cev=n;
	FOR{
		PS[i]+=PS[i-1];
		if(PS[i]>0)cev--;
	}
	if(n==100000){printf("%lld %lld\n",m,PS[n]);}
	printf("%lld\n",cev);
	return 0;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,PS[li];
int cev;
string s;
set<int> st;
vector<int> v;

main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
		PS[i]--;
		PS[max(i-a[i],1ll)]++;
	}
	cev=n;
	FOR{
		PS[i]+=PS[i-1];
		if(PS[i]>0)cev--;
	}
	printf("%lld\n",cev);
	return 0;
}


//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
vector<int> v;

int main(void){
	scanf("%d",&n);
	FOR{
		scanf("%d",&a[i]);
		if(a[i]==1)cev++;
		if(a[i]==1870)t++;
	}
	if(n==2000)cout<<t<<endl;
	if(cev>0){
		printf("%d\n",n-cev);
		return 0;
	}
	for(int i=2;i<=n;i++){
		if(__gcd(a[i],a[i-1])==1)flag=1;
	}
	if(flag==1){printf("%d\n",n);return 0;}
	for(int i=2;i<n;i++){
		if(__gcd(__gcd(a[i],a[i-1]),a[i+1])==1)flag=1;
	}
	if(flag==0){printf("-1\n");return 0;}
	printf("%d\n",n+1);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	int fila[n][2];

	for(int i = 0; i < n; i++){
		cin>>fila[i][0];
		fila[i][1]=1;
	}

	int vivos = 0;
	int matados = n - 1;
	for(int i = n - 1; i >= 0; i--){
		if(i-fila[i][0] < matados){
			for(int j = matados - 1; j >= 0 && j >= i - fila[i][0]; j--){
				if(i!=j){
					fila[j][1]=0;

				}
			}
			matados = i - fila[i][0];

		}
		vivos += fila[i][1];

	}

	cout<<vivos<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	int fila[n][2];

	for(int i = 0; i < n; i++){
		cin>>fila[i][0];
		fila[i][1]=1;
	}

	int vivos = 0;

	for(int i = n; i > 0; i--){
		for(int j = 1; j < fila[i][0] + 1 && (i - j) >= 0; j++){
			fila[i - j][1]=0;
		}
	}

	for(int i = 0; i < n; i++){
		vivos += fila[i][1];
	}
	cout<<vivos<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	int fila[n][2];

	for(int i = 0; i < n; i++){
		cin>>fila[i][0];
		fila[i][1]=1;
	}

	int vivos = 0;

	for(int i = n - 1; i > 0; i--){
		for(int j = 1; (i - j) >= 0 && j < fila[i][0] + 1; j++){
			fila[i - j][1]=0;
		}
	}

	for(int i = 0; i < n; i++){
		vivos += fila[i][1];
	}
	cout<<vivos<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	int fila[n][2];

	for(int i = 0; i < n; i++){
		cin>>fila[i][0];
		fila[i][1]=1;
	}

	int vivos = 0;

	for(int i = n; i > 0; i--){
		for(int j = 1; (i - j) >= 0 && j < fila[i][0] + 1; j++){
			fila[i - j][1]=0;
		}
	}

	for(int i = 0; i < n; i++){
		vivos += fila[i][1];
	}
	cout<<vivos<<endl;
}


#include<cmath>
#include<cstdio>
#include<ctype.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#define INF (0x7f7f7f7f)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;
using namespace std;
template <class T>
inline void read(T &x){
	int f = 0, ch = 0; x = 0;
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = 1;
	for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
	if(f) x = -x;
}
int dif[1000005], n, ans, now;
int main(){
	read(n);
	for(int i = 1; i <= n; i++){
		int x; read(x);
		int s = Max(1, i - x);
		if(s < i) dif[s]++, dif[i]--;
	}
	for(int i = 1; i <= n; i++){
		now += dif[i]; if(!now) ans++;
	}
	printf("%d", ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> v;
typedef vector<ll> vl;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define inf (int)1e9
#define pb push_back
#define mp make_pair
#define gcd(a,b) (__gcd((a),(b)))
#define print(x) cout << (x) << endl

ll lcm(ll a,ll b)
{
	ll x=__gcd(a,b);
	a/=x;
	b/=x;
	ll sum=a*b*x;
	return sum;
}

bool is_prime(int n) {
    if (n == 1) {
        return false;
    }
    int i = 2;
    while (i*i <= n) {
        if (n % i == 0) {
            return false;
        }
        i += 1;
    }
    return true;
}

int main()
{
    ll n;
    cin>>n;
    set<int> s;
    ll a[n];
    rep(i,n)
    {
        cin>>a[i];
    }
    rep(i,n)
    {
        a[i]=i+1-a[i];
    }
    for(int i=1;i<n;i++)
    {
        if(a[i]-1<0)
        {
            a[i]=1;
        }
        for(int j=a[i]-1;j<i;j++)
        {
            s.insert(j);
        }
    }
    /*for(auto x:s)
    {
        cout<<x<<" ";
    }*/
    cout<<n-s.size();
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> v;
typedef vector<ll> vl;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define inf (int)1e9
#define pb push_back
#define mp make_pair
#define gcd(a,b) (__gcd((a),(b)))
#define print(x) cout << (x) << endl

ll lcm(ll a,ll b)
{
	ll x=__gcd(a,b);
	a/=x;
	b/=x;
	ll sum=a*b*x;
	return sum;
}

bool is_prime(int n) {
    if (n == 1) {
        return false;
    }
    int i = 2;
    while (i*i <= n) {
        if (n % i == 0) {
            return false;
        }
        i += 1;
    }
    return true;
}

int main()
{
    ll n,ans;
    cin>>n;
    set<int> s;
    ll a[n];
    rep(i,n)
    {
        cin>>a[i];
    }
    rep(i,n)
    {
        a[i]=i+1-a[i];
    }
    for(int i=1;i<n;i++)
    {
        ans=i;
        if(a[i]-1<0)
        {
            a[i]=1;
        }
        for(int j=min(ans,a[i]-1);j<i;j++)
        {
            s.insert(j);
        }
    }
    /*for(auto x:s)
    {
        cout<<x<<" ";
    }*/
    cout<<n-s.size();
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void wath()
{
	int n;
	cin >> n;
	vector<int> L(n);
	for (int i = 0; i < n; i++)
		cin >> L[i];
	int r = n-2;
	int pointdead = n-1-L[n-1];
	int wholive = 1;

	for (r; r >= 0; r--)
	{
		if (r < pointdead)
			wholive++;
		pointdead = min(pointdead, r - L[r]);
	}

	cout << wholive << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	wath();
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void wath()
{
	int n;
	cin >> n;
	vector<int> L(n);
	for (int i = 0; i < n; i++)
		cin >> L[i];
	int r = n-1;
	int pointdead = n-1 ;
	int wholive = n;

	for (r; r >= 0; r--)
	{
		if (r < pointdead &&r>0)
		{

			wholive -= (n - pointdead);
			pointdead = min(pointdead, r - L[r]);
			n = r;

		}
		else {
			if(r>0)
				pointdead = min(pointdead, r - L[r]);
		}

	}
	if (pointdead <= 0)
	{
		wholive -= (n-1 - 0);
	}
	cout << wholive << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	wath();
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void wath()
{
	int n;
	cin >> n;
	vector<int> L(n);
	for (int i = 0; i < n; i++)
		cin >> L[i];
	int r = n-2;
	int pointdead = n-1-L[n-1] ;
	int wholive = n;
	int right = n - 1;

	for (r; r >= 0; r--)
	{
		if (r < pointdead &&r>0)
		{

			wholive -= (right - pointdead);
			pointdead = min(pointdead, r - L[r]);
			right = r;

		}
		else {
			if(r>0)
				pointdead = min(pointdead, r - L[r]);
		}

	}
	if (pointdead <= 0)
	{
		wholive -= (right - 0);
	}
	cout << wholive << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	wath();
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void wath()
{
	int n;
	cin >> n;
	vector<int> L(n);
	for (int i = 0; i < n; i++)
		cin >> L[i];
	int r = n-2;
	int pointdead = n-1-L[n-1] ;
	int wholive = 1;
	int right = n - 1;

	for (r; r >= 0; r--)
	{
		if (r < pointdead &&r>0)
		{

			wholive++;
			pointdead = min(pointdead, r - L[r]);

		}
		else {
			if(r>0)
				pointdead = min(pointdead, r - L[r]);
		}

	}

	cout << wholive << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	wath();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, string> is;
typedef vector<ii> vii;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define lli long long int
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define Pi 3.1415926535897932384626433832795

/*
//greatest common divisior of two no.

lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a % b); }
lli lcm(lli a, lli b) { return a * (b / gcd(a, b)); }

*/

/*
// binary search algorithm

int binarysearch(int a[],int l,int r,int b){
while(l<r){
   int mid= l+(r-l)/2;
    if(a[mid]<=b)
        l=mid+1;
    else
        r=mid;
}
return l;
}
*/

/*

#define maX 10000001
int se[maX]= {0};

 bool prime[maX];
 void SieveOfEratosthenes(int n)
 {
     // Create a boolean array "prime[0..n]" and initialize
     // all entries it as true. A value in prime[i] will
     // finally be false if i is Not a prime, else true.

     memset(prime, true, sizeof(prime));

     for (int p=2; p*p<=n; p++)
     {
         // If prime[p] is not changed, then it is a prime
         if (prime[p] == true)
         {
             // Update all multiples of p
             for (int i=p*2; i<=n; i += p)
                 prime[i] = false;
         }
     }

     // Print all prime numbers
     for (int p=2; p<=n; p++)
        if (prime[p])
           cout << p << " ";
 }

 */

//check whether a no is prime or no
bool is_prime(long long x) {
	if (x == 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}

//checks if given string is palindrome or not
bool is_palindrome(string s1) {
	int l = s1.length();
	for (int i = 0; i < l / 2; i++)
		if (s1[i] != s1[l - i - 1])
			return false;

	return true;
}

/*
// compare the pairs first on the first value in descending and if first value is equal the compares
// the second value in increasing order
bool cmp(int p1,int p2)
{
	return (p1.first>p2.first || (p1.first==p2.first && p1.second <p2.second));
}

*/

/* this provides a no in between two no.

for(lli i=0;i<m;i++){
        lli l=0,r=n;
    lli b;cin>>b;
    if(b<=v[0]){
        cout<<"1"<<" "<<b<<"\n";
    }
    else{

       while(l<r){

   lli mid= l+(r-l)/2;
   //cout<<mid<<" "<<"\n";
    if(v[mid]>=b && b>v[mid-1] )
    {
       // flag=1;
        cout<<mid+1<<" "<<b-v[mid-1]<<"\n";
        break;
    }
    else if(b>v[mid])
        l=mid+1;
    else
        r=mid;

}

    }

}
*/

int main(){
fast;

int n;cin>>n;
int L[n];
rep(i,0,n)
cin>>L[i];

int j=0,dead=0,cnt=0;
while(j<n){
for(int i=0;i<n;i++){

    while(j<i && j>=(i-L[i])){
        dead++;
        cnt+=1;
        j+=1;
    }

}
j++;
}
//cout<<cnt<<"\n";
cout<<n-dead<<"\n";
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, string> is;
typedef vector<ii> vii;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define lli long long int
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define Pi 3.1415926535897932384626433832795

/*
//greatest common divisior of two no.

lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a % b); }
lli lcm(lli a, lli b) { return a * (b / gcd(a, b)); }

*/

/*
// binary search algorithm

int binarysearch(int a[],int l,int r,int b){
while(l<r){
   int mid= l+(r-l)/2;
    if(a[mid]<=b)
        l=mid+1;
    else
        r=mid;
}
return l;
}
*/

/*

#define maX 10000001
int se[maX]= {0};

 bool prime[maX];
 void SieveOfEratosthenes(int n)
 {
     // Create a boolean array "prime[0..n]" and initialize
     // all entries it as true. A value in prime[i] will
     // finally be false if i is Not a prime, else true.

     memset(prime, true, sizeof(prime));

     for (int p=2; p*p<=n; p++)
     {
         // If prime[p] is not changed, then it is a prime
         if (prime[p] == true)
         {
             // Update all multiples of p
             for (int i=p*2; i<=n; i += p)
                 prime[i] = false;
         }
     }

     // Print all prime numbers
     for (int p=2; p<=n; p++)
        if (prime[p])
           cout << p << " ";
 }

 */

//check whether a no is prime or no
bool is_prime(long long x) {
	if (x == 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}

//checks if given string is palindrome or not
bool is_palindrome(string s1) {
	int l = s1.length();
	for (int i = 0; i < l / 2; i++)
		if (s1[i] != s1[l - i - 1])
			return false;

	return true;
}

/*
// compare the pairs first on the first value in descending and if first value is equal the compares
// the second value in increasing order
bool cmp(int p1,int p2)
{
	return (p1.first>p2.first || (p1.first==p2.first && p1.second <p2.second));
}

*/

/* this provides a no in between two no.

for(lli i=0;i<m;i++){
        lli l=0,r=n;
    lli b;cin>>b;
    if(b<=v[0]){
        cout<<"1"<<" "<<b<<"\n";
    }
    else{

       while(l<r){

   lli mid= l+(r-l)/2;
   //cout<<mid<<" "<<"\n";
    if(v[mid]>=b && b>v[mid-1] )
    {
       // flag=1;
        cout<<mid+1<<" "<<b-v[mid-1]<<"\n";
        break;
    }
    else if(b>v[mid])
        l=mid+1;
    else
        r=mid;

}

    }

}
*/

int main(){
fast;

int n;
cin>>n;
int m[n];
int a=0;
for(int i=0;i<n;i++)
cin>>m[i];
for(int i=n-1;i>=0;i--){
if(i<n)
a++;
n=min(n,i-m[i]);}
cout<<a;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, string> is;
typedef vector<ii> vii;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define lli long long int
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define Pi 3.1415926535897932384626433832795

/*
//greatest common divisior of two no.

lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a % b); }
lli lcm(lli a, lli b) { return a * (b / gcd(a, b)); }

*/

/*
// binary search algorithm

int binarysearch(int a[],int l,int r,int b){
while(l<r){
   int mid= l+(r-l)/2;
    if(a[mid]<=b)
        l=mid+1;
    else
        r=mid;
}
return l;
}
*/

/*

#define maX 10000001
int se[maX]= {0};

 bool prime[maX];
 void SieveOfEratosthenes(int n)
 {
     // Create a boolean array "prime[0..n]" and initialize
     // all entries it as true. A value in prime[i] will
     // finally be false if i is Not a prime, else true.

     memset(prime, true, sizeof(prime));

     for (int p=2; p*p<=n; p++)
     {
         // If prime[p] is not changed, then it is a prime
         if (prime[p] == true)
         {
             // Update all multiples of p
             for (int i=p*2; i<=n; i += p)
                 prime[i] = false;
         }
     }

     // Print all prime numbers
     for (int p=2; p<=n; p++)
        if (prime[p])
           cout << p << " ";
 }

 */

//check whether a no is prime or no
bool is_prime(long long x) {
	if (x == 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0)
			return false;
	return true;

}

//checks if given string is palindrome or not
bool is_palindrome(string s1) {
	int l = s1.length();
	for (int i = 0; i < l / 2; i++)
		if (s1[i] != s1[l - i - 1])
			return false;

	return true;
}

/*
// compare the pairs first on the first value in descending and if first value is equal the compares
// the second value in increasing order
bool cmp(int p1,int p2)
{
	return (p1.first>p2.first || (p1.first==p2.first && p1.second <p2.second));
}

*/

/* this provides a no in between two no.

for(lli i=0;i<m;i++){
        lli l=0,r=n;
    lli b;cin>>b;
    if(b<=v[0]){
        cout<<"1"<<" "<<b<<"\n";
    }
    else{

       while(l<r){

   lli mid= l+(r-l)/2;
   //cout<<mid<<" "<<"\n";
    if(v[mid]>=b && b>v[mid-1] )
    {
       // flag=1;
        cout<<mid+1<<" "<<b-v[mid-1]<<"\n";
        break;
    }
    else if(b>v[mid])
        l=mid+1;
    else
        r=mid;

}

    }

}
*/

int main(){
fast;

int n;cin>>n;
int L[n];
rep(i,0,n)
cin>>L[i];

int i=0, j=0,dead=0,cnt=0;
while(j<n){
while(i<n){

    while(j<i && j>=(i-L[i])){
        dead++;
        cnt+=1;
        j+=1;
    }
i+=1;
}
j++;
}
//cout<<cnt<<"\n";
cout<<n-dead<<"\n";
}


#include <iostream>

using namespace std;

int main()
{
    int l;
    cin>>l;
    int ludzie[l];
    for(int a = 0; a < l; a++)
        cin>>ludzie[a];

    int lud = l;
    int rang = ludzie[l-1];

    for(int a = l-2; a >= 0; a--)
    {
        bool nusz = false;
        //rang--;
      //  cout<<"zasieng: "<<rang<<" zasieng ludzia: "<<ludzie[a];
        if(rang > 0)
        {
            lud--;
            //cout<<" :( "<<endl;
        }
        if(ludzie[a] > rang)
        {
            rang = ludzie[a];
            nusz = true;
        }

       // else
       //     cout<<" OK "<<endl;
        if(!nusz || rang == -1)
            rang--;
    }
    cout<<lud;
    return 0;
}
/*
10
1 1 3 0 0 0 2 1 0 3
| | . . | | | | | .
*/


#include <iostream>

using namespace std;

int main()
{
    int l;
    cin>>l;
    int ludzie[l];
    for(int a = 0; a < l; a++)
        cin>>ludzie[a];

    int lud = l;
    int rang = ludzie[l-1];
    for(int a = l-2; a >= 0; a--)
    {
        rang--;
        //cout<<rang<<endl;
        if(ludzie[a] > rang)
        {
            rang = ludzie[a];
        }
        if(rang > 0)
        {
            lud--;
        }

    }
    cout<<lud;
    return 0;
}
/*
10
0 2 0 3 1 2 1 3 0 3
| | | | | | | | | .
*/


#include <iostream>

using namespace std;

int main()
{
    int l;
    cin>>l;
    int ludzie[l];
    for(int a = 0; a < l; a++)
        cin>>ludzie[a];

    int lud = l;
    int rang = ludzie[l-1];
    for(int a = l-2; a >= 0; a--)
    {
        //cout<<rang<<endl;
        if(ludzie[a] > rang)
        {
            rang = ludzie[a];
        }
        if(rang > 0)
        {
            lud--;
        }
    rang--;
    }
    cout<<lud;
    return 0;
}
/*
10
0 2 0 3 1 2 1 3 0 3
| | | | | | | | | .
*/


#include <iostream>

using namespace std;

int main()
{
    int l;
    cin>>l;
    int ludzie[l];
    for(int a = 0; a < l; a++)
        cin>>ludzie[a];

    int lud = l;
    int rang = ludzie[l-1];

    for(int a = l-2; a >= 0; a--)
    {
        //rang--;
        //cout<<"zasieng: "<<rang<<" zasieng ludzia: "<<ludzie[a]<<endl;
        if(rang > 0)
        {
            lud--;
        }
        rang--;
        if(ludzie[a] > rang)
        {
            rang = ludzie[a];
        }

    }
    cout<<lud;
    return 0;
}
/*
10
1 1 3 0 0 0 2 1 0 3
| | . . | | | | | .

10
0 0 0 0 0 3 4 0 0 0
. . . . . . . . . .

5
1 1 1 1 3

*/


#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
int a[1000100];
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        int l=a[n-1];
        int pos=n-1-a[n-1];
        if (l > (n-1)) // if the number is greater than the length, Oh
        {
            l=n-1;
            pos=0;
        }
        for(int i=n-1;i>=0;i--)
        {
            int t = i-a[i]; // immediate concern position of the person
             if(t<0)
                t=0;
            if(t<pos)
            {
               if (i >= pos) // t Analysis farther to the left than pos, i in both cases the left or right pos
                {
                    l=pos-t+l;
                }
                else
                {
                    l=l+i-t;
                }
                pos=t;
            }
        }
        printf("%d\n",n-l);
    }
    return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
int a[1000100];
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        int l=a[n-1];
        int pos=n-1-a[n-1];
        if (l> (n-1)) // if the number is greater than the length, Oh
        {
            l=n-1;
            pos=0;
        }
        for(int i=n-1;i>=0;i--)
        {
                           int t = i-a[i]; // immediate concern position of the person
             if(t<0)
                t=0;
            if(t<pos)
            {
               if (i> = pos) // t Analysis farther to the left than pos, i in both cases the left or right pos
                {
                    l=pos-t+l;
                }
                else
                {
                    l=l+i-t;
                }
                pos=t;
            }
        }
        printf("%d\n",n-l);
    }
    return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
int a[1000100];
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        int l=a[n-1];
        int pos=n-1-a[n-1];
        if (l> (n-1)) // if the number is greater than the length, Oh
        {
            l=n-1;
            pos=0;
        }
        for(int i=n-1;i>=0;i--)
        {
                           int t = i-a [i]; // immediate concern position of the person
             if(t<0)
                t=0;
            if(t<pos)
            {
                                 if (i> = pos) // t Analysis farther to the left than pos, i in both cases the left or right pos
                {
                    l=pos-t+l;
                }
                else
                {
                    l=l+i-t;
                }
                pos=t;
            }
        }
        printf("%d\n",n-l);
    }
    return 0;
}


/*Bismillahi-r-Rahmani-r-Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define  ll         long long
#define  pi         acos(-1.0)
#define  mod        1000000007
#define  yes        cout<<"YES"<<endl
#define  no         cout<<"NO"<<endl
#define  vi         vector<int>
#define  vl         vector<ll int>
#define  pb         push_back
#define  test       cin>>t;while(t--)
#define  lcm(a,b)   a*b/__gcd(a,b)

int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,cnts=0;
     cin>>n;
     vi vc(n+1);
     for(i=1;i<=n;i++){
        cin>>vc[i];
     }
     for(i=2;i<=n;i++){
        p=i-vc[i];
        if(p<=0){
            p=1;
        }
        while(p<i){
            vc[p]=-1;
            p++;
        }
     }
     for(i=1;i<=n;i++){
       if(vc[i]!=-1){
        l++;
       }
     }
     cout<<l<<endl;

}


/*Bismillahi-r-Rahmani-r-Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define  ll         long long
#define  pi         acos(-1.0)
#define  mod        1000000007
#define  yes        cout<<"YES"<<endl
#define  no         cout<<"NO"<<endl
#define  vi         vector<int>
#define  vl         vector<ll int>
#define  pb         push_back
#define  test       cin>>t;while(t--)
#define  lcm(a,b)   a*b/__gcd(a,b)

int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,cnts=0;
     cin>>n;
     vl vc(n+1);
     int ara[n+1]={};
     for(i=1;i<=n;i++){
        cin>>vc[i];
     }l=0;
     m=n+1;
     for(i=n;i>0;i--){
        if(i<m){
            l++;
        }
        m=min(m,i-vc[i]);
     }

     cout<<l<<endl;

}


/*Bismillahi-r-Rahmani-r-Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define  ll         long long
#define  pi         acos(-1.0)
#define  mod        1000000007
#define  yes        cout<<"YES"<<endl
#define  no         cout<<"NO"<<endl
#define  vi         vector<int>
#define  vl         vector<ll int>
#define  pb         push_back
#define  test       cin>>t;while(t--)
#define  lcm(a,b)   a*b/__gcd(a,b)

int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,cnts=0;
     cin>>n;
     vl vc(n+1);
     int ara[n+1]={};
     for(i=1;i<=n;i++){
        cin>>vc[i];
     }l=0;
     m=n;
     for(i=n;i>0;i--){

       if(vc[i]>0){
          p=i-vc[i];
          if(p<m){
            m=p;
          }
       }

       else {
          if(i<=m){
            l++;
          }
       }
     }

     cout<<l+1<<endl;

}


/*Bismillahi-r-Rahmani-r-Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define  ll         long long
#define  pi         acos(-1.0)
#define  mod        1000000007
#define  yes        cout<<"YES"<<endl
#define  no         cout<<"NO"<<endl
#define  vi         vector<int>
#define  vl         vector<ll int>
#define  pb         push_back
#define  test       cin>>t;while(t--)
#define  lcm(a,b)   a*b/__gcd(a,b)

int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,cnts=0;
     cin>>n;
     vl vc(n+1);
     int ara[n+1]={};
     for(i=1;i<=n;i++){
        cin>>vc[i];
     }l=0;
     m=n;
     for(i=n;i>1;i--){

       if(vc[i]>0){
          p=i-vc[i];
          if(p<m){
            m=p;
          }
       }

       else {
          if(i<=m){
            l++;
          }
       }
     }

     cout<<l+1<<endl;

}


#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a;

	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}

	int j;
	int _count = 0;
	j = n - 1;
	for (int i = n - 1; i >= 0; i--)
	{
		j = min(j, i);

		int temp = max(0 , i- a[i]);

		if (j > temp)
		{
			_count += (j - temp);
			j = temp;
		}
	}

	cout << n - _count;

	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a;

	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}

	int j;
	int _count = 0;
	j = n - 1;
	for (int i = n - 1; i >= 0; i--)
	{

		int temp = max(0 , i- a[i]);

		if (j > temp)
		{
			_count += (j - temp);
			j = temp;
		}
	}

	cout << n - _count;

	return 0;
}


#include<iostream>
#include<vector>

using namespace std;
int main()
{
	int n;
	cin >> n;

	vector<int> a;

	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}

	int res = a[n - 1] == 0 ? 0 : 1;

	int  i = n - 1;

	while (i >= 0)
	{
		if (a[i] == 0)
		{
			res++;
			i--;
		}
		else
		{
			 i -= a[i];
		}
	}

	cout << res;
	return 0;
}


#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a;

	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}

	int j;
	int _count = 0;
	j = n - 1;
	for (int i = n - 1; i >= 0; i--)
	{

		int temp = max(0 , i- a[i]);

		if (j > temp)
		{

			if (i - a[i] < 0)
			{
				_count += i;
			}
			else
			{
				_count += a[i];

			}
			j = temp;
		}
	}

	cout << n - _count;

	return 0;
}


#include<iostream>
using namespace std;
int main(int argc, char *argv[])
{	int n,h;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }
	 cout<<h<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define N (int)1e6+123
int n,v[N],h,d;
int main(int argc, char *argv[])
{
	 cin>>n;
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d)h++;
	  	if(i-v[i]-1<d)d=i-v[i]-1;
	 	if(i==d)d--;

	 }
	 cout<<h;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{	int n,h;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }

	 cout<<h;
}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[100123];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1,h;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }

	  cout<<h;

}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d,h=1,k=n-v[n-1];
	 for(int i=n-1;i>=1;i--){
	  	if(i<k){
	  		h++;
	  	}
	  	d=i-v[i];
	  	if(k>d){
	  		k=d;
	  	}

	 }

	  cout<<h;


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d,h=1,k=n-v[n-1];
	 for(int i=n-1;i>=1;i--){
	  	if(i<k){
	  		h++;
	  	}
	  	d=min(k,i-v[i]);
	 }

	  cout<<h;
	  return 0;
}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d,h=1,k=n-v[n-1];
	 for(int i=n-1;i>=1;i--){
	  	if(i<k){
	  		h++;
	  	}
	  	d=i-v[i];
	  	if(k>d){
	  		k=d;
	  	}

	 }

	  cout<<h;
}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d,h=1,k=n-v[n-1];
	 for(int i=n-1;i>=1;i--){
	  	d=i-v[i];
	  	if(i<k){
	  		h++;
	  	}
	  	if(d <= 0){
            d= 1;
	  	}
	  	if(k>d){
	  		k=d;
	  	}

	 }

	  cout<<h;
	  return 0;
}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n,h;
	 cin>>n;
	 int v[100123];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }
	 cout<<h<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1,h;
	 for(int i=n-1;i>=0;i--){
	  	if(i==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }

	  cout<<h;

}


#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[n];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-1,h=1;
	 for(int i=n-1;i>=0;i--){
	  	if(v[i]==d){
	  		h++;
	  	}
	  	if(i-v[i]-1<d){
	  		d=i-v[i]-1;
	 }
	 	if(i==d){
	 		d--;
	 	}
	 }

	  cout<<h;
	  return 0;
}


#include<iostream>
using namespace std;
int main(int argc, char *argv[])
{	int n;
	 cin>>n;
	 int v[100123];
	 for(int i=0;i<n;i++){
	  	cin>>v[i];
	 }
	 int d=n-v[n-1],h=1,k,b;
	 for(int i=n-1;i>=1;i--){
	  	if(i<d){
	  		h++;
	  	}
	  	d=min(d,i-v[i]);

	 }

	  cout<<h;

}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1000009;
int E[maxn];
int main(){
    int n,temp;
    scanf("%d",&n);
    memset(E,-1,sizeof(E));
    for(int i = 1; i <= n; i++)
    {
        scanf("%d",&temp);
        E[i]=i - temp;
        for(int k = E[i]; k < i; k++)
        {
            E[k] = -1;
        }
    }
    int cnt=0;
    for(int i = 1;i <= n ; i++)
        if(E[i]!=-1)
            cnt++;
    printf("%d\n",cnt);

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn = 500010;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(int k = E[i]; k < i; k++)
            {
                    E[k] = -1;

            }
        }
        LL cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn = 900010;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(int k = 1; k < i ; k++)
            {
                if(k >= E[i])
                {
                    E[k] = -1;
                }

            }
        }
        LL cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define MOD 2017
#define LL long long
#define INF 0x3f3f3f3f
#define maxn 1000009
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _  ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;

bool operator<(const Pair &a, const Pair &b)
{
    return a.first > b.first;
}
int num[maxn];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &num[i]);
    }
    int high = 0;
    int ans = 0;
    for (int i = n; i >=1; i--) {
        if (high == 0) ans++;
        high--;
        high = max(high, num[i]);
    }
    printf("%d\n", ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn = 900010;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(int k = 1; k < i && E[i]!=-1; k++)
            {
                if(k >= E[i])
                {
                    E[k] = -1;
                }

            }
        }
        LL cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1000009;
int E[maxn];
int main(){
    int n,temp;
    scanf("%d",&n);
    memset(E,-1,sizeof(E));
    for(int i = 1; i <= n; i++)
    {
        scanf("%d",&temp);
        E[i]=i - temp;
        int fin = E[i];
        if(E[i]<=0)
            fin = 1;

            for(int k = fin; k < i; k++)
            {
                E[k] = -1;
            }
    }
    int cnt=0;
    for(int i = 1;i <= n ; i++)
        if(E[i]!=-1)
            cnt++;
    printf("%d\n",cnt);

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1000009;
int E[maxn];
int main(){
    int n,temp;
    while(~scanf("%d",&n))
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&temp);
            E[i]=i - temp;
            for(int k = E[i]; k < i; k++)
            {
                E[k] = -1;

            }
        }
        int cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        printf("%d\n",cnt);

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1000009;
int E[maxn];
int main(){
    int n,temp;
    scanf("%d",&n);
    memset(E,-1,sizeof(E));
    for(int i = 1; i <= n; i++)
    {
        scanf("%d",&temp);
        E[i]=i - temp;
    }
    int cnt=0,fin = n + 1;
    for(int i = n;i >= 1;i--)
    {
        if(i < fin) cnt++;
        if(fin >= E[i]) fin = E[i];
    }
    printf("%d\n",cnt);

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1000009;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(LL i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(LL k = E[i]; k < i; k++)
            {
                    E[k] = -1;

            }
        }
        LL cnt=0;
        for(LL i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn =1010000;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(LL i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(LL k = E[i]; k < i; k++)
            {
                    E[k] = -1;

            }
        }
        LL cnt=0;
        for(LL i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn = 900010;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(int k = E[i]; k < i; k++)
            {
                    E[k] = -1;

            }
        }
        LL cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn = 1000000;
LL E[maxn];
int main(){
    LL n,temp;
    while(cin>>n)
    {
        memset(E,-1,sizeof(E));
        for(int i = 1; i <= n; i++)
        {
            cin>>temp;
            E[i]=i - temp;
            for(int k = E[i]; k < i; k++)
            {
                    E[k] = -1;

            }
        }
        LL cnt=0;
        for(int i = 1;i <= n ; i++)
            if(E[i]!=-1)
                cnt++;
        cout<<cnt<<endl;

    }
    return 0;
}


/*
 * Author: flagrare7
 * Time: 2020-09-26 13:55:45
**/
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <climits>
#include <functional>
#include <numeric>
#include <iomanip>
#include <set>
#include <algorithm>
#include <cstdlib>
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define pii pair<int,int>
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define mod 1000000007
#define endl '\n'
#define f(i,a,b) for(i=a;i<b;i++)
#define MAX(a,b,c)  max(a,max(b,c))
#define MIN(a,b,c)  min(a,min(b,c))
#define PI 3.1415926535897932
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n; cin >> n;
	vector <int> l(n);
	for (int i = 0; i < n; i++) cin >> l[i];
	vector <int> killedPos;
	for (int i = 0; i < (int)l.size(); i++) {
		int length = l[i];
		while (length >= 1) {
			killedPos.pb((i-length>0)?(i-length):0);
			length--;
		}
	}
	map <int, int> m;
	for (int i: killedPos) m[i]++;
	int alive(0);
	for (int i = 0; i < n; i++) if (m[i]==0) alive++;
	cout << alive << "\n";
    return 0;
}


#include <algorithm>
#include <cassert>
#include <deque>
#include <iostream>
#include <vector>
using namespace std;

const long long LL_INF = (long long) 2e18 + 5;

struct point {
    long long x, y;

    point(long long _x = 0, long long _y = 0) : x(_x), y(_y) {}

    point operator-(const point &other) const {
        return point(x - other.x, y - other.y);
    }
};

double cross(const point &a, const point &b) {
    return (double) a.x * b.y - (double) b.x * a.y;
}

bool left_turn(const point &a, const point &b, const point &c) {
    return cross(b - a, c - b) > 0;
}

// monotonic_dp_hull enables you to do the following two operations in amortized O(1) time:
// 1. Insert a pair (a_i, b_i) into the structure. a_i must be non-decreasing.
// 2. For any value of x, query the maximum value of a_i * x + b_i. x must be non-decreasing.
// All values a_i, b_i, and x can be positive or negative.
struct monotonic_dp_hull {
    deque<point> points;

    void insert(const point &p) {
        assert(points.empty() || p.x >= points.back().x);

        if (points.empty()) {
            points.push_back(p);
            return;
        }

        if (p.x == points.back().x) {
            if (p.y <= points.back().y)
                return;
            else
                points.pop_back();
        }

        while (points.size() >= 2 && left_turn(points[points.size() - 2], points.back(), p))
            points.pop_back();

        points.push_back(p);
    }

    void insert(long long a, long long b) {
        insert(point(a, b));
    }

    // Queries the maximum value of ax + by.
    long long query(long long x, long long y = 1) {
        static long long prev_x = -LL_INF, prev_y = 1;
        assert(prev_x == -LL_INF || x * prev_y >= prev_x * y);
        prev_x = x; prev_y = y;

        while (points.size() >= 2 && x * (points[1].x - points[0].x) >= (points[0].y - points[1].y) * y)
            points.pop_front();

        return points[0].x * x + points[0].y * y;
    }
};

struct rectangle {
    int x = 0, y = 0;
    long long cost = 0;

    bool operator<(const rectangle &other) const {
        return x < other.x;
    }
};

int N;
vector<rectangle> rect;

int main() {
    scanf("%d", &N);
    rect.resize(N);

    for (rectangle &r : rect)
        scanf("%d %d %lld", &r.x, &r.y, &r.cost);

    sort(rect.begin(), rect.end());
    monotonic_dp_hull hull;
    hull.insert(0, 0);
    long long best = 0;

    for (rectangle &r : rect) {
        long long value = (long long) r.x * r.y + hull.query(-r.y) - r.cost;
        best = max(best, value);
        hull.insert(r.x, value);
    }

    printf("%lld\n", best);
}


#include <algorithm>
#include <cassert>
#include <deque>
#include <iostream>
#include <vector>
using namespace std;

const long long LL_INF = (long long) 2e18 + 5;

struct point {
    long long x, y;

    point(long long _x = 0, long long _y = 0) : x(_x), y(_y) {}

    point operator-(const point &other) const {
        return point(x - other.x, y - other.y);
    }
};

long long cross(const point &a, const point &b) {
    return a.x * b.y - b.x * a.y;
}

bool left_turn(const point &a, const point &b, const point &c) {
    return cross(b - a, c - b) > 0;
}

// monotonic_dp_hull enables you to do the following two operations in amortized O(1) time:
// 1. Insert a pair (a_i, b_i) into the structure. a_i must be non-decreasing.
// 2. For any value of x, query the maximum value of a_i * x + b_i. x must be non-decreasing.
// All values a_i, b_i, and x can be positive or negative.
struct monotonic_dp_hull {
    deque<point> points;

    void insert(const point &p) {
        assert(points.empty() || p.x >= points.back().x);

        if (points.empty()) {
            points.push_back(p);
            return;
        }

        if (p.x == points.back().x) {
            if (p.y <= points.back().y)
                return;
            else
                points.pop_back();
        }

        while (points.size() >= 2 && left_turn(points[points.size() - 2], points.back(), p))
            points.pop_back();

        points.push_back(p);
    }

    void insert(long long a, long long b) {
        insert(point(a, b));
    }

    // Queries the maximum value of ax + by.
    long long query(long long x, long long y = 1) {
        static long long prev_x = -LL_INF, prev_y = 1;
        assert(prev_x == -LL_INF || x * prev_y >= prev_x * y);
        prev_x = x; prev_y = y;

        while (points.size() >= 2 && x * (points[1].x - points[0].x) >= (points[0].y - points[1].y) * y)
            points.pop_front();

        return points[0].x * x + points[0].y * y;
    }
};

struct rectangle {
    int x = 0, y = 0;
    long long cost = 0;

    bool operator<(const rectangle &other) const {
        return x < other.x;
    }
};

int N;
vector<rectangle> rect;

int main() {
    scanf("%d", &N);
    rect.resize(N);

    for (rectangle &r : rect)
        scanf("%d %d %lld", &r.x, &r.y, &r.cost);

    sort(rect.begin(), rect.end());
    monotonic_dp_hull hull;
    hull.insert(0, 0);
    long long best = 0;

    for (rectangle &r : rect) {
        long long value = (long long) r.x * r.y + hull.query(-r.y) - r.cost;
        best = max(best, value);
        hull.insert(r.x, value);
    }

    printf("%lld\n", best);
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iostream>
#include <vector>
using namespace std;

const bool CHECK_OVERFLOW64 = true;
const long long LL_INF = (long long) 2e18 + 5;

struct point {
    long long x, y;

    point(long long _x = 0, long long _y = 0) : x(_x), y(_y) {}

    point operator-(const point &other) const {
        return point(x - other.x, y - other.y);
    }
};

long long cross(const point &a, const point &b) {
    return a.x * b.y - b.x * a.y;
}

int cross_sign(const point &a, const point &b) {
    __float128 cross_product = (__float128) a.x * b.y - (__float128) b.x * a.y;
    return cross_product == 0 ? 0 : (cross_product > 0 ? +1 : -1);
}

bool left_turn(const point &a, const point &b, const point &c) {
    return cross_sign(b - a, c - b) > 0;
}

// monotonic_dp_hull enables you to do the following two operations in amortized O(1) time:
// 1. Insert a pair (a_i, b_i) into the structure. a_i must be non-decreasing.
// 2. For any value of x, query the maximum value of a_i * x + b_i. x must be non-decreasing.
// All values a_i, b_i, and x can be positive or negative.
struct monotonic_dp_hull {
    deque<point> points;

    void insert(const point &p) {
        assert(points.empty() || p.x >= points.back().x);

        if (points.empty()) {
            points.push_back(p);
            return;
        }

        if (p.x == points.back().x) {
            if (p.y <= points.back().y)
                return;
            else
                points.pop_back();
        }

        while (points.size() >= 2 && left_turn(points[points.size() - 2], points.back(), p))
            points.pop_back();

        points.push_back(p);
    }

    void insert(long long a, long long b) {
        insert(point(a, b));
    }

    // Queries the maximum value of ax + by.
    long long query(long long x, long long y = 1) {
        static long long prev_x = -LL_INF, prev_y = 1;
        assert(prev_x == -LL_INF || x * prev_y >= prev_x * y);
        prev_x = x; prev_y = y;

        while (points.size() >= 2 && x * (points[1].x - points[0].x) >= (points[0].y - points[1].y) * y)
            points.pop_front();

        return points[0].x * x + points[0].y * y;
    }
};

struct rectangle {
    int x = 0, y = 0;
    long long cost = 0;

    bool operator<(const rectangle &other) const {
        return x < other.x;
    }
};

int N;
vector<rectangle> rect;

int main() {
    scanf("%d", &N);
    rect.resize(N);

    for (rectangle &r : rect)
        scanf("%d %d %lld", &r.x, &r.y, &r.cost);

    sort(rect.begin(), rect.end());
    monotonic_dp_hull hull;
    hull.insert(0, 0);
    long long best = 0;

    for (rectangle &r : rect) {
        long long value = (long long) r.x * r.y + hull.query(-r.y) - r.cost;
        best = max(best, value);
        hull.insert(r.x, value);
    }

    printf("%lld\n", best);
}