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