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

ans = 0
i = 0
while i < n:
    if p[i-1] == i and p[i] == i+1:
        ans += 1
        i += 1
    elif p[i-1] == i:
        ans += 1
    i += 1
print(ans)