#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int p,res = 0;
	int prev = -2;
	for (int i = 0; i < N; ++i) {
		cin >> p;
		if (((i+1)-p) == 0) {
			if (i != prev+1) {
				++res;
				prev = i;
			}
			else {
				prev = -2;
			}
		}
	}
	cout << res << endl;
	return 0;
}
