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