N = int(input())
p = list(map(int, input().split()))

def solve(i, c):
    if i == N - 1:
        return c
    if p[i] == i+1:
        a = p[i]
        p[i] = p[i+1]
        p[i+1] = a
        c += 1
    return solve(i+1, c)

print(solve(0, 0))