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