#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, p;
  cin >> n;
  std::deque<int> deq;
  for (int i = 0; i < n; i++) {
    cin >> p;
    deq.emplace_back(p);
  }
  int count = 0;
  for (int j = 0; j < n - 1; j++) {
    if (deq[j] == j + 1 || deq[j + 1] == j + 2) {
      swap(deq[j], deq[j + 1]);
      count++;
      if (deq[j] == j + 1) {
        if (deq[j - 1] != j + 1) {
          swap(deq[j - 1], deq[j]);
        }
      }
    }
  }
  cout << count << endl;
}
