#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int arr[n], i;
  for (i = 0; i < n; i++) cin >> arr[i];
  int flag = 0;
  int end, ans = 0;
  for (i = n - 1; i >= 1; i--) {
    if (arr[i] == 0) continue;
    int k = i - arr[i];
    if (k < 0) k = 0;
    int a = n - i;
    int b = n - 1 - k;
    if (flag == 0) {
      flag = 1;
      ans = a;
      end = b;
    } else {
      if (a > end) ans += a - end - 1;
      if (b > end) end = b;
    }
  }
  if (flag == 1)
    ans += n - (end + 1);
  else
    ans = n;
  cout << ans << endl;
  return 0;
}
