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