#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<bool> c(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == i + 1) c[i] = 1;
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (c[i] || c[i + 1]) {
      c[i] = 0;
      c[i + 1] = 0;
      ans++;
    }
  }
  cout << ans << endl;
}
