def solve():
    n = int(input())
    l = list(map(int,input().split()))
    res = 0
    for i in range(n-1):
        if l[i]==i+1:
            l[i],l[i+1]=l[i+1],l[i]
            res+=1
    print(res)
if __name__=='__main__':
    solve()