n=int(input())
p=list(map(int,input().split()))
cnt=0
i=0
while i<(n-1):
    for i in range(n-1):
        if ((i+1)!=p[i] and (i+1+1)==p[i+1]) or ((i+1)==p[i] and (i+1+1)!=p[i+1]) or ((i+1)==p[i] and (i+1+1)==p[i+1]):
            p[i],p[i+1]=p[i+1],p[i]
            cnt+=1
            i+=1
    i+=1
print(cnt)