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