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