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