#include<iostream>

using namespace std;

int main() {
	int n, a, b[100001]{ 0 };
	cin >> n;
	for (int i = 0; i<n; i++) {
		cin >> a;
		if (a == i + 1)b[i] = 1;
	}
	int cnt = 0;
	for (int i = 0; i < n;) {
		if (b[i]) {
			cnt++;
			i += 2;
		}
		else i++;
	}
	cout << cnt << endl;
	return 0;
}