#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int array[100010] = {};
  int answer = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> array[i];
  }
  for (int i = 1; i <= N - 1; i++) {
    if (array[i] == i) {
      int memo = array[i];
      array[i] = array[i + 1];
      array[i + 1] = memo;
      answer++;
    }
  }
  int answer_2 = 0;
  for (int i = N; i > 1; i++) {
    if (array[i] == i) {
      int memo = array[i];
      array[i] = array[i - 1];
      array[i + 1] = memo;
      answer_2++;
    }
  }
  cout << min(answer, answer_2) << endl;
  return 0;
}
