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