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