#include<iostream>
using namespace std;
int main(void){
	int num=0;
	cin>>num;
	int count=0;
	bool before=false;
	for(int i=1;i<=num;i++){
		int a=0;
		cin>>a;
		if(a==i){
			if(!before){
				count++;
				before=true;
			}else{
				before=false;
			}
		}else{
			before=false;
		}
	}
	cout<<count<<endl;
	return 0;
}