n = int(input())
p = [int(_) for _ in input().split()]

ans = 0
for i in range(n-1):
    if p[i] == i+1:
        ans += 1
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
    #print(i+1, ans, p)
print(ans)