n = int(input())
p = list(map(int, input().split()))

ans = 0
c = 0
for i, p_ in enumerate(p):
    #print(p_, i+1, p_==i+1, c, ans)
    if p_ == i + 1:
        c += 1
    else:
        ans += 1 if c == 1 else max(c - 1, 0)
        c = 0
ans += 1 if c == 1 else max(c - 1, 0)

print(ans)

