def swap(q,i,j)
    tmp = q[j]
    q[j] = q[i]
    q[i] = tmp
end
N = gets.to_i
q = gets.split.map(&:to_i)
res = 0
(N-1).times do |i|
    n = i + 1
    if n == q[i] then
        if q[i] != n+1 && q[i+1] != n then
            swap(q,i,i+1)
            res += 1
        end
    end
end
puts res
