n = int(input())
ary = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i+1 == ary[i]:
        a = ary[i]
        b = ary[i+1]
        ary[i] = b
        ary[i+1] = a
        ans += 1
    else:continue
print(ans)