N = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(N):
    if p[0] == 1:
        value = p[i]
        p[i] = p[i+1]
        p[i+1] = value
        cnt += 1
    elif p[i] == i+1:
        value = p[i]
        p[i] = p[i-1]
        p[i-1] = value
        cnt += 1
print(cnt)
    