N = int(input())
p = [int(x) for x in input().split()]
cnt = 0
flag = True
for ind,i in enumerate(p):
    if(ind+1==i and flag):
        cnt+=1
        if(p[ind+1]==ind+2):
            flag = False
    else:
        flag = True
print(cnt)