N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(len(a)):
    if i+1 < N:
        if a[i] == i+1:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
            cnt +=1
print(cnt)