#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)

int main() {
	int n,tmp,ans=0;
	scanf("%d\n", &n);
	rep(i,n) {
		scanf("%d", &tmp);
		if (tmp == i+1) {ans++; i++;}
	printf("%d", ans);
}