#include <bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int> p(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}

	int counter = 0;
	for (int i = 0; i < n-1; i++) {
		if (p[i] == i+1) {
			counter++;
			i++;
		}
	}
	if (p[n - 1] == n && n%2!=0) { counter++; }
	cout << counter << endl;
