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