#include <iostream>
using namespace std;

int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		int p;
		cin >> p;
		if (p == i) {
			ans++;
			if (i < N) {
				cin >> p;
				i++;
			}
		}
	}
	cout << ans << endl;
}
