#include<stdio.h>
int a[100002];
int main(){
	int n,ans=0,t;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)
		scanf("%d",&a[i]);
	for(int i = 1;i <= n;i++){
		if(a[i]==i){
			t=a[i];a[i]=a[i+1];a[i+1]=t;
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}