#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n;
  scanf("%d", &n);
  int b = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    if (a[i] == i || a[i + 1] == i + 1) {
      swap(a[i], a[i + 1]);
      b++;
    }
  }
  printf("%d\n", b);
  return 0;
}
