#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n,p[100000],count=0;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> p[i];
	for (int i = 0; i < n; i++) {
		if (i+1 == p[i]) {
			swap(p[i], p[i + 1]);
			count++;
		}
	}
	cout << count << endl;
	int x;
	cin >> x;
	return 0;
}
