#include <iostream>
#include <vector>

using namespace std;

int main() {
	int N;
	cin >> N;

	bool swapped= false;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		int tmp;
		cin >> tmp;
		if (tmp == i && !swapped) 
		{ 
			ans++;
			swapped = true;
		}
		else swapped = false;
	}

	cout << ans << endl;

	return 0;
}