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 2:n-1
		if p[i]==i && p[i+1]==i+1
			p[i+1] = i
			p[i] = i+1
			k += 1
		elseif p[i] == i
			p[i] = p[i-1]
			p[i-1] = i
			k += 1
		end 
	end
	if p[1] == 1
		k += 1
	end
	println(k)
end
main()
