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