N = int(input())
P = list(map(int, input().split()))
index = []

for i, p in enumerate(P):
    index.append(p-(i+1))
    
ans = 0
seq = 0
for i in index:
    if i == 0:
        ans += 1
        seq += 1
    else:
        if seq > 1:
            ans -= (seq-1)
        seq = 0

if seq > 1:
    ans -= (seq-1)
print(ans)