def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    cnt = 0
    i = 0
    while i < N-1:
        if P[i] == i+1:
            P[i],P[i+1] = P[i+1],P[i]
            cnt += 1
            i += 1
            continue
        if P[i+1] == i+2 and P[i] == i+2:
            P[i],P[i+1] = P[i+1],P[i]
            cnt += 1
            i += 2
            continue
        i += 1
    print(cnt)

if __name__ == '__main__':
    main()