N = int(input())
p = list(map(int, input().split()))
p_T = []
for i, v in enumerate(p, 1):
    if i == v:
        p_T.append(True)
    else:
        p_T.append(False)

cnt = 0
for i in range(len(p_T) - 1):
    if p_T[i]:
        cnt += 1
        p_T[i] = False
        p_T[i + 1] = False
print(cnt)
