def D_Derangement(N, p):
    count = 0
    i = 0
    while i < N - 1:
        if p[i] == i+1:
            if p[i+1] == i+2:
                count += 1
                i += 2
                continue
            else:
                count += 1
                i+=1
                continue
        else:
            i+=1
            continue
    return count

N = int(input())
p = [int(i) for i in input().split()]
print(D_Derangement(N, p))