input()
nums = list(map(int, input().split()))
lis = [num - (i + 1) for i, num in enumerate(nums)]
cnt = 0
i = 0
while i < len(lis):
    if lis[i] == 0:
        cnt += 1
        if lis[i + 1] == 0:
            i += 1
    i += 1
print(cnt)