#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p[100000] = {}, a[100000] = {}, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    if (p[i] == i + 1) {
      a[i] = 1;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == 1) {
      a[i + 1] = 0;
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}
