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