#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  long long ans = 0;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (i - x <= 0)
      v[i] = 0;
    else
      v[i] = i - x;
  }
  int last = v[n - 1];
  ans += (n - 1) - v[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    if (v[i] >= last) continue;
    if (i > last)
      ans += last - v[i];
    else
      ans += i - v[i];
    last = v[i];
  }
  cout << n - ans << endl;
  return 0;
}
