N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(N-1):
    if p[i] == i+1:
        a = p[i]
        b = p[i+1]
        p[i] = b
        p[i+1] = a
        count += 1
print(count)
