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