
#include <iostream>
#include <vector>
using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> p(N);
  for (auto & _p : p)
    cin >> _p;
  int cnt = 0;
  for (int i = 0; i < N; ++i)
  {
    if (p[i] - 1 == i)
    {
      ++cnt;
      ++i;
    }
  }
  cout << cnt;
  return 0;
}
