def solve():
    N = int(input())
    P = list(map(int, input().split()))
    cnt = 0
    for i, p in enumerate(P):
        i = i+1
        if p == i:
            cnt += 1
            if i != N and P[i] == p+1:
                P[i-1],P[i] = P[i], P[i-1]
            else:
                P[i-2],P[i-1] = P[i-1], P[i-2]
                
    print(cnt)
    
solve()