#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, lki, kills = 0, temp;
  long long* L = new long long[1000001];
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%ld", &L[i]);
  }
  lki = (n - 1) - L[n - 1];
  kills += min(L[n - 1], n - 1);
  for (i = n - 2; i > 0; i--) {
    if (lki <= 0) break;
    if (L[i] > i) L[i] = i;
    temp = i - L[i];
    if (temp < lki) {
      if (i < lki) {
        kills += L[i];
      } else {
        temp = L[i] - (i - lki);
        kills += temp;
      }
      lki = i - L[i];
    }
  }
  cout << n - kills << endl;
  return 0;
}
