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