#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  int count = 0;
  vector<int> p;
  const long long int size = 100001;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    p.push_back(num);
  }
  for (int i = 0; i < n - 1; ++i) {
    if (p[i] == i + 1 || p[i + 1] == i + 2) {
      swap(p[i], p[i + 1]);
      ++count;
    }
  }
  cout << count << endl;
  return 0;
}
