#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main() {
	int N, cnt = 0;
	cin >> N;
	vector<int> p(N);
	for (auto& i : p) cin >> i;
	for (int i = 0; i < N; i++) {
		if (p[i] == i + 1) {
			swap(p[i], (i == N - 1 ? p[i - 1] : p[i + 1]));
			cnt++;
		}
	}
	cout << cnt << endl;
}
