add algorithm for count one of a number