N = int(input())
p = list(map(int, input().split()))
p = [i - 1 for i in p]
ans = 0

for i in range(1, N):
    if p[i - 1] == i - 1 and p[i] != i:
        p[i - 1], p[i] = p[i], p[i - 1]
        ans += 1
    elif p[i - 1] != i - 1 and p[i] == i:
        p[i - 1], p[i] = p[i], p[i - 1]
        ans += 1
    elif p[i - 1] == i - 1 and p[i] == i:
        p[i - 1], p[i] = p[i], p[i - 1]
        ans += 1

print(ans)