N = int(input())
L = list(map(int, input().split()))
count = 0
flag = -1
for i in range(N):
    if i+1 == L[i]:
        count += 1
        if flag == i:
            count -= 1
        flag = i+1
print(count)