N = int(input())
p = [int(i) for i in input().split()]
count = 0
i = 0
while i < N:
    if p[i]-1==i:
        if p[i+1]-1==i+1:
            i += 1
            count += 1
        else:
            count += 1
    i += 1

print(count)