N = int(input())
P = list(map(int, input().split()))

from itertools import groupby

answer = 0
for k,g in groupby([p==i for p, i in zip(P, range(1,N+1))]):
  if k:
    l = len(list(g))
    if l==1:
      answer +=1
    else:
      answer += l-1
      
print(answer)
      