n = int(input())
num_list = list(map(int,input().split()))
cnt = 0
for i,num in enumerate(num_list):
    if i != len(num_list)-1: 
        if i+1 == num:
            cnt += 1
            if num_list[i+1] == i+2:
                cnt -= 1
    else:
        if i+1 == num:
            cnt += 1
print(cnt)