#include <bits/stdc++.h>
using namespace std;
int N, P[100000];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> P[i];
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (P[i] == i + 1) {
      swap(P[i], P[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
