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