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