n = int(input())
num_list = list(map(int, input().split())) + [-1]


cnt = 0
ret = 0


for i in range(n):
    num = num_list[i]
    if num == i+1:
        cnt += 1
    else:
        if cnt:
            ret += (cnt+1) // 2
            cnt = 0


print(ret)


