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

now = count = 0
while(now<N):
    if p[now]==now+1:
        tmp = p[now]
        p[now] = p[now+1]
        p[now+1] = tmp
        now -= 1
        count += 1
        continue
    now += 1
print(count)

