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