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

count = 0
for i in range(1, plen):
    if p[i] == i :
        if p[i] == N:
            p[i -1], p[i] = p[i], p[i - 1]
            count += 1
            break
        else:
            p[i], p[i + 1] = p[i + 1], p[i]
            count += 1
print(count)
