N = int(input())
L = list(map(int,input().split()))
ans = 0
flag = 0
while flag == 0 :
    counter = 0
    for i in range(N) :
        if (i+1) == L[i] :
            ans += 1
            for j in range(N) :
                if i != j and ((i+1) != L[j]) :
                    L[i],L[j] = L[j],L[i]
                    break
        else :
            counter += 1
    if counter == N :
        flag = 1
print(ans)
