#include <iostream>
using namespace std;

int main() {
	int N, p, ans = 0, tmp = 0;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> p;
		if (p == i + 1) ++tmp;
		else {
			ans += (tmp + 1) / 2;
			tmp = 0;
		}
	}
	ans += (tmp + 1) / 2;
	cout << ans;
}