#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p[100000], count = 0, ans = 0;
  bool same = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    if (i + 1 == p[i]) {
      count++;
      if (i == n - 1) {
        if (count > 1) {
          ans += (count - 1);
          count = 0;
        } else if (count == 1) {
          ans += 1;
          count = 0;
        }
      }
    } else if (count > 1) {
      ans += (count - 1);
      count = 0;
    } else if (count == 1) {
      ans += 1;
      count = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
