#include <cstdio>
#include <algorithm>
#define MAXN (int)(1e5+105)
using namespace std;
int a[MAXN];
int main() {
	int n, cnt = 0;
	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) {
			swap(a[i], a[i+1]);
			cnt ++;
		}
	}
	printf("%d\n", cnt);
	return 0;
} 