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

ans = 0

def f(i, j):
    tmp = p[i]
    p[i] = p[j]
    p[j] = tmp

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

print(ans)
