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