n = int(input())
p = list(map(int, input().split()))
info = []
cnt = 0
j = 0

for i in range(n):
    info.append(p[i] - i - 1)
# print(info)

if n == 2:
    if p == [1, 2]:
        print(1)
        quit()
    else:
        print(0)
        quit()

while j <= n-1:
    if info[j] == 0:
        cnt += 1
        j += 2
    else:
        j += 1

if info[-1] == 0:
    cnt += 1

print(cnt)