local n = io.read("*n")
local t = {}
for i = 1, n do t[i] = io.read("*n") end
local cnt = 0
for i = 1, n - 1 do
  if(t[i] == i) then
    t[i], t[i + 1], cnt = t[i + 1], t[i], cnt + 1
  end
end
if(t[n] == n) then cnt = cnt + 1 end
print(cnt)
