N = int(input())
P = list(map(int,input().split()))
cntxx = 0
cntx = 0
i = 0
while i < N-1:
    if P[i] == i+1 and P[i+1] == i+2:
        cntxx += 1
        i += 1
    elif P[i] == i+1:
        cntx += 1
    i += 1
print(cntx+cntxx)