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