#include <stdio.h>
#define maxn 10000 
int a[maxn] ;
int main(int argc, char *argv[])
{
	int n,k=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]) ;
	int m = n,i=0;
	while(m){
		if(a[i] == i+1 ||a[i+1] == i+2) {int t = a[i+1];a[i+1] = a[i];a[i] = t ;k++ ; } 
		m -- ;
		i ++ ;
	}
	printf("%d",k) ;
	return 0;
}