#include <bits/stdc++.h>
int main() {
  using namespace std;
  int N;
  cin >> N;
  int p[N];
  int i, count = 0;
  for (i = 0; i < N; ++i) {
    cin >> p[i];
  }
  if (p[0] == 1) {
    swap(p[0], p[1]);
    ++count;
  }
  for (i = 1; i < N; ++i) {
    if (p[i] == i + 1) {
      if (p[i + 1] == i + 1) {
        swap(p[i], p[i - 1]);
      } else if (p[i - 1] == i + 1) {
        swap(p[i], p[i + 1]);
      }
      ++count;
    }
  }
  cout << count << endl;
  return 0;
}
