#include<iostream>
using namespace std;

int main() {
	int i, N;
	int ans = 0;
	bool *p;
	cin >> N;
	p = new bool[N];
	for (i = 0; i < N; i++) {
		int t;
		cin >> t;
		p[i] = t == i + 1;
	}
	for (i = 0; i < N; i++) 
		if (p[i]) {
			if (p[i + 1]) i++;
			ans++;
		}
	cout << ans << endl;
	return 0;
}