#coding:utf-8

N = int(input())
p_list = list(map(int, input().split(" ")))

order_list = range(1, N + 1)

count = 0
for i in range(N):
    if p_list[i] == order_list[i] and i != N - 1:
        if p_list[i + 1] == order_list[i + 1]:
            continue
        else:
            count += 1
    elif p_list[i] == order_list[i]:
        count += 1
print (count)

