#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,y=0;
	cin>>n;
	int a[n],b[n+1];
	for(int i=0;i<n;i++){
		cin>>a[i];
		(i+1==a[i]) ? (b[i]=1):(b[i]=0);
	}
	b[n]=0;
	for(int i=0;i<n;i++){
		if(b[i]){
			y++;
			b[i]=0;
			b[i+1]=0;
		}
	}
	cout<<y;
	return 0;
}
