#include <iostream>

using namespace std;

long long int N, p[100001] = {}, num = 0;
bool flag[100001] = {};

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> p[i];
		if (p[i] == i) {
			num++;
			flag[i] = true;
			if (flag[i - 1]) {
				num--;
				flag[i] = false;
			}
		}
	}
	cout << num << endl;
	return 0;
}