N = int(input())
P = [int(i) for i in input().split()]

flag = 0
cnt = 0
for i, p in enumerate(P):
    if p == i + 1 and flag == 0:
        cnt += 1
        flag = 1
    elif p != i + 1:
        flag = 0
        
print(cnt)