#include <bits/stdc++.h>
using namespace std;
int n;
int p[100000];
vector<int> conti;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      if (i != 0 && p[i - 1] == 1) {
        conti[conti.size() - 1] += 1;
      } else {
        conti.push_back(1);
      }
    }
  }
  int output = 0;
  for (int i = 0; i < conti.size(); i++) {
    output += ceil(double(conti[i]) / 2);
  }
  cout << output << endl;
}
