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