#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int count = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n - 1; i++) {
    if (a.at(i) == i + 1 && a.at(i + 1) == i + 2) {
      count += 1;
      i++;
    } else if (a.at(i) == i + 1) {
      count++;
    }
  }
  if (a.at(n - 1) == n && a.at(n - 2) == n - 1) {
  } else {
    if (a.at(n - 1) == n) {
      count++;
    }
  }
  cout << count << endl;
}
