n = int(input())
*p, = map(int, input().split())
ans = 0
for i in range(n-1):
    if (p[i] == (i+1) or p[i+1] == (i+2)):
        if p[i] == (i+2) or p[i+1] == (i+1):
            continue
        ans += 1
        p[i], p[i+1] = p[i+1], p[i]
print(ans)
