import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums() {
	return readln().chomp.split.map!(to!int);
}

void main() {
	auto numsCount = readNums();
	bool before = false;
	size_t count = 0;
	foreach(i, n; readNums().enumerate) {
		if(!before && (i + 1) == n) {
			++count;
			before = true;
		} else {
			before = false;
		}
	}
	writefln("%d", count);
}
