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