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