
N = int(input())
P = list(map(int,input().split()))
#PS = [i for i in range(1,N+1)]

cnt = 0
i = 0
idx = []
while i < N:
    if P[i] == i+1:
        if P[i+1] == i+2:
            cnt += 1
            i += 1
        else:
            cnt += 1
                   
    i += 1   
print(cnt)
    
    