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