n = int(input())
p = list(map(int, input().split()))

ans = 0
tmp = 0
for i in range(n):
  if i+1 == p[i] :
    ans += (tmp+1)//2
    tmp = 0
  else:
    tmp += 1
    
ans += (tmp+1)//2
print(ans)
    
    