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