human
Count numbers that don 't contain 3 | Returns count of numbers which are in range from 1 to n and don 't contain 3 as a digit.
Base Cases ( n is not negative ).
Calculate 10 ^ ( d - 1 ) ( 10 raise to the power d - 1 ) where d is number of digits in n . po will be 100 for n = 578.
Find the MSD ( msd is 5 for 578 ).
For 578 , total will be 4 * count ( 10 ^ 2 - 1 ) + 4 + ccount ( 78 ).
For 35 total will be equal to count ( 29 ).
Driver Program"
Solution in Python:

=====
Give me a code to count numbers that don 't contain 3 and the other steps required?
assistant
#Here is code to count numbers that don 't contain 3 and the other steps required.
 def count ( n ) :
	if n < 3 :
		return n
	elif n >= 3 and n < 10 :
		return n - 1
	po = 1
	while n / po > 9 :
		po = po * 10
	msd = n / po
	if msd != 3 :
		return count ( msd ) * count ( po - 1 ) + count ( msd ) + count ( n % po )
	else :
		return count ( msd * po - 1 )
n = 578
print count ( n )