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

counter = 0

for i in range(N-1):
    if p[i] == i+1:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        counter += 1

print(counter)