n = int(input())
li = list(map(int,input().split()))

def swap(a,b):
    c = li[a]
    li[a] = li[b]
    li[b] = c

ans = 0
i = 0
while i < n-1:
    memo = i+1

    if memo == li[i]:
        swap(i,i+1)
        ans += 1
        i+= 1
    i+=1
    

print(ans)

