def solve(n, P):
    count = 0
    for i in range(n):
        if i == P[i] - 1:
            count += 1
            if i + 1 < n and i + 1 == P[i + 1] - 1:
                count -= 1
    return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))
