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