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