N = int(input())
p = list(map(int,input().split()))
ans = 0
i=0
while i<N-1:
    if p[i]==i+1 or p[i+1]==i+2:
        p[i],p[i+1] = p[i+1],p[i]
        ans += 1
        i += 2
    else:
        i+=1
print(ans)