msd countWhile