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