#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, count = 0;
  vector<int> p;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    p.push_back(tmp);
  }
repeat:
  for (int i = 0; i < p.size() - 1; i++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      count++;
      goto repeat;
    } else if (p[i + 1] == i + 1 + 1) {
      swap(p[i], p[i + 1]);
      count++;
      goto repeat;
    }
  }
  cout << count;
  return 0;
}
