N = int(input())
p = list(map(int, input().split()))
answer = 0
streak = 0
for i in range(1, N):
    if i == p[i-1]:
        answer += 1
        if i-1 == p[i-2]:
            answer -= 1
            temp = p[i-1]
            p[i-1] = p[i-2]
            p[i-2] = temp

print(answer)
        