#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> place(n);
  for (int i = 0; i < n; i++) cin >> place[i];
  int count = 0;
  for (int i = 1; i < n - 1; i++) {
    if (place[i] == i + 1 && place[i + 1] == i + 2) {
      swap(place[i], place[i + 1]);
      count++;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (place[i] == i + 1) {
      swap(place[i], place[i + 1]);
      count++;
    }
  }
  cout << count << endl;
}
