n = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(n - 1):
    if P[i] == i + 1 or P[i + 1] == i + 2:
        P[i], P[i + 1] = P[i + 1], P[i]
        count += 1

print(count)