n = int(input())
p = [int(x) for x in input().split()]

ans = 0
index = 0

while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1

print(ans)