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