n = int(input())
p_list = [ int(v) for v in input().split() ]

ans = 0
for i in range(n-1):
    if p_list[i] == i+1 or p_list[i+1] == i+2:
        p_list[i], p_list[i+1] = p_list[i+1], p_list[i]
        ans += 1
print(ans)
