#include <bits/stdc++.h>
using namespace std;
void swap(int &l, int &r) {
  int tmp = l;
  l = r;
  r = tmp;
}
int main() {
  int N;
  scanf("%d", &N);
  int p[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &p[i]);
  }
  int count = 0;
  for (int i = 0; i < N; ++i) {
    if (p[i] == i + 1 && i != 0) {
      if (p[i - 1] < p[i + 1]) {
        swap(p[i], p[i - 1]);
      } else {
        swap(p[i], p[i + 1]);
      }
      count++;
    } else if (p[i] == i + 1 && i == 0) {
      swap(p[0], p[1]);
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
