import random
n = 10**4
m = 10**10
bad = 0
digs = 1000
for i in range(0,n):
bigger = random.randint(m/2,m)
smaller = random.randint(digs,bigger/2)
x = bigger/smaller
while x/10 > 0: x /= 10
bigger_x = bigger
while bigger_x / digs > 0: bigger_x /= digs
smaller_x = smaller
while smaller_x / digs >0: smaller_x /= digs
if bigger_x < smaller_x: bigger_x *= 10
if bigger_x / smaller_x != x: bad += 1
print bad