#include <bits/stdc++.h>
using namespace std;
int a[100003];
int main() {
  int n, sghhy, bdhjh = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < n - 1; j++)
    if ((a[j] == j + 1) and (a[j + 1] == j + 2)) {
      a[j] = a[j + 1];
      a[j + 1] = a[j];
      bdhjh++;
    }
  for (int hc = 0; hc < n; hc++) {
    if (a[hc] == hc + 1) {
      sghhy = a[hc];
      if (hc == n - 1) {
        a[hc] = a[hc - 1];
        a[hc - 1] = sghhy;
      } else {
        a[hc] = a[hc] + 1;
        a[hc + 1] = sghhy;
        bdhjh++;
      }
    }
  }
  cout << bdhjh;
  system("pause");
  return 0;
}
