#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 2);
  for (int i = 0; i < n; i++) cin >> a[i + 1];
  a[0] = a[n + 1] = -1;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == i) {
      if (a[i + 1] == i + 1) continue;
      swap(a[i], a[i + 1]);
      cnt++;
    }
    if (a[i + 1] == i + 1) {
      if (a[i] == i) continue;
      swap(a[i], a[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
