#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int n,bef=0,c=0,a;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (a == i&&bef == 0) {
			c++;
			bef = 1;
		}
		else bef = 0;
	}
	cout <<c<< endl;
}