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