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

cnt = 0
if p[0] == 1:
    p[0],p[1] = p[1],p[0]
    cnt += 1

for i in range(1,N):
    if p[i] == i+1:
        p[i],p[i-1] = p[i-1],p[i]
        cnt += 1

print(cnt)