#include<cstdio>
#define maxn 100010
int val[maxn]; 
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&val[i]);
	}
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(i!=n&&val[i]==i&&val[i+1]==i+1){
			cnt++;i++;
		}
		else if(val[i]==i)cnt++;
	}
	printf("%d",cnt);
}