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