N = int(input())
p = list(map(int, input().split()))

ans = 0
flag = False
for i in range(N):
    if flag:
        n = p[i+1]
    else:
        n = p[i]
    if n == i+1:
        ans += 1
        flag = True
    else:
        flag = False
print(ans)