#include <bits/stdc++.h>
using namespace std;
int imax = INT_MAX;
int imin = INT_MIN;
long long llmax = LLONG_MAX;
long long llmin = LLONG_MIN;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k(0);
  bool f = false;
  while (!f) {
    f = true;
    for (int i = 0; i < n - 1; i++) {
      if ((a[i] == i + 1 && a[i] != i + 2) ||
          (a[i + 1] == i + 2 && a[i + 1] != i + 1)) {
        f = false;
        k++;
        int t = a[i + 1];
        a[i + 1] = a[i];
        a[i] = t;
      }
    }
  }
  cout << k << endl;
  return 0;
}
