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