#include <iostream>
using namespace std;

int n, p[100001], ans = 0;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
	}

	for (int i = 1; i <= n; i++) {
		if (p[i] == i) {
			i++;
			ans++;
		}
	}

	cout << ans << endl;
}