#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, buf, c = 0, t = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> buf;
    if (buf == i + 1) {
      c++;
    } else {
      if (c == 1) {
        t++;
      } else if (c > 1) {
        t += c - 1;
      }
      c = 0;
    }
  }
  cout << t;
  return 0;
}
