#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, bool> > P;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int p;
  for (int i = 1; cin >> p; i++) {
    P.push_back(make_pair(p, p == i));
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (P[i].second) {
      P[i].second = false;
      P[i + 1].second = false;
      ans++;
    }
  }
  cout << ans << "\n";
}
