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

count = 0

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