#include <iostream>
using namespace std;

int main()
{
  int N;
  cin >> N;
  
  int ret = 0, trail = 0;
  for (int i = 1;i <= N; i++) {
    	int a;
    cin >> a;
    if (a == i) {
      	trail++;
    } else {
      ret += ++trail / 2;
      	trail = 0;
    }
  }
  ret += ++trail / 2;
  cout << ret << endl;
};