parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	p = readline() |> split |> parseMap
	k = 0
	for i in 1:n-1
		if p[i]==i
			p[i+1] = i
			p[i] = i+1
			k += 1
		end
	end
	println(k)
end
main()
