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