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