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