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

i = 1
ans = 0
while i < len(p):
    if p[i-1] == i:
        c1 = p[i-1]
        c2 = p[i]
        p[i-1] = c2
        p[i] = c1
        ans += 1
    i += 1

    
        
print(ans)