N = int(input())
P = list(map(int, input().split()))
res = 0
idx = 0
while idx < N - 1:
    if P[idx] == idx + 1 or P[idx+1] == idx + 2:
        res += 1
        idx += 1
        if idx >= N - 1:
            break
    if P[idx] == idx + 1 and P[idx+1] == idx + 2:
        res -= 1
    idx += 1

print(res)
