#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int P[N];
  for (int i = 0; i < (int)N; i++) {
    int a;
    cin >> a;
    P[i] = a - 1;
  }
  int count = 0;
  for (int i = 0; i < (int)N; i++) {
    if (P[i] == i) {
      if (i > 0) {
        int t = P[i - 1];
        P[i - 1] = P[i];
        P[i] = t;
        count += 1;
      } else if (i < N - 1) {
        int t = P[i + 1];
        P[i + 1] = P[i];
        P[i] = t;
        count += 1;
      }
    }
  }
  cout << count << endl;
  return 0;
}
