#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, p[100001], count = 0, tmp;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> p[i];
  }
  for (int i = 1; i <= N - 1; i++) {
    if (i == p[i]) {
      tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
