#include <bits/stdc++.h>
using namespace std;
int stp = 0;
int aaa(int x, int y) {
  int tmp = x;
  x = y + 1;
  y = tmp - 1;
  stp++;
}
int soto(int s[], int n) {
  int i;
  for (i = 0; i < n; i++) {
    if (s[i] != 0)
      continue;
    else if (s[i] == 0 && i == 0) {
      aaa(s[i], s[i + 1]);
      continue;
    } else if (s[i] == 0 && s[i - 1] != 1) {
      aaa(s[i - 1], s[i]);
      continue;
    } else if (s[i] == 0 && s[i + 1] != -1) {
      aaa(s[i], s[i + 1]);
      continue;
    }
  }
  int coun = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == 0) {
      coun++;
    }
  }
  return coun;
}
int main() {
  int n, tmp, soe[114514];
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &tmp);
    soe[i] = tmp - (i + 1);
  }
  soto(soe, n);
  printf("%d\n", stp);
}
