#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    int p;
    cin >> p;
    if (p == i) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}
