import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    p=LI()
    ans=0
    for i in range(N):
        if p[i]==i+1:
            p[i],p[i+1]=p[i+1],p[i]
            ans+=1
            
    print(ans)

main()
