N = int(input())
plist = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if plist[i] == i + 1 or plist[i + 1] == i + 2:
        plist[i], plist[i + 1] = plist[i + 1], plist[i]
        ans += 1
print(ans)

