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