#include <bits/stdc++.h>
using namespace std;
int p[100005];
int main() {
  int n, i;
  int temp;
  int cnt;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &p[i]);
    }
    cnt = 0;
    for (i = 0; i < n; i++) {
      if (p[i] == i + 1) {
        cnt++;
        if (i == 0) {
          temp = p[i];
          p[i] = p[i + 1];
          p[i + 1] = temp;
        } else {
          temp = p[i];
          p[i] = p[i - 1];
          p[i - 1] = temp;
        }
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
