#include <bits/stdc++.h>
using namespace std;
int main() {
  bool f = true;
  long long N, ans = 0;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
    if (i + 1 == A[i]) f = false;
  }
  if (f) {
    cout << ans << endl;
    return 0;
  }
  for (long long i = 0; i < N; i++) {
    if (A[i] == i + 1) {
      if (i > 0 && A[i - 1] != i) {
        swap(A[i], A[i - 1]);
        ans++;
      } else {
        swap(A[i], A[i + 1]);
        ans++;
      }
    }
  }
  cout << ans << endl;
}
