N=int(input())
p=list(map(int,input().split()))
count=0
import collections

s=collections.deque()
for i in range(N):
  if p[i]==i+1:
    s.append(i)
ans=0
while(s):
  x=s.popleft()
  if x+1 in s:
    s.popleft()
  ans+=1
  
print(ans)
