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