def hum(n):

  x = [0]*(n+1)

  x[1] = 1

  for e in [2, 3, 5]:

    for i in range(n/e+1):

      if x[i]: x[i*e] = 1

  return x



M = []

N = []

while 1:

  try: m,n = list(map(int, input().split()))

  except: break

  M.append(m)

  N.append(n)

H = hum(max(N))

for m, n in zip(M,N):

  print(sum(H[m:n+1]))
def f(x, I, n):

  while x[-1]<=n:

    a = [x[I[0]]*2, x[I[1]]*3, x[I[2]]*5]

    b = min(a)

    c = a.index(b)

    if b > x[-1]: x += [b]

    I[c] += 1

  return



while 1:

  try: m,n = list(map(int, input().split()))

  except: break

  x = [1]

  I = [0, 0, 0]

  f(x, I, m-1)

  a = len(x)

  f(x, I, n)

  print(len(x)-a)
def hum(n):
    x = [0] * (n + 1)
    x[1] = 1
    for e in [2, 3, 5]:
        for i in range(n / e + 1):
            if x[i]:
                x[i * e] = 1
    return x


M = []
N = []
while 1:
    try:
        m, n = list(map(int, input().split()))
    except:
        break
    M.append(m)
    N.append(n)
H = hum(max(N))
for m, n in zip(M, N):
    print(sum(H[m : n + 1]))

def f(x, I, n):
    while x[-1] <= n:
        a = [x[I[0]] * 2, x[I[1]] * 3, x[I[2]] * 5]
        b = min(a)
        c = a.index(b)
        if b > x[-1]:
            x += [b]
        I[c] += 1
    return


while 1:
    try:
        m, n = list(map(int, input().split()))
    except:
        break
    x = [1]
    I = [0, 0, 0]
    f(x, I, m - 1)
    a = len(x)
    f(x, I, n)
    print(len(x) - a)

-def hum(n): -    x = [0] * (n + 1) -    x[1] = 1 -    for e in [2, 3, 5]: -        for i in range(n / e + 1): -            if x[i]: -                x[i * e] = 1 -    return x +def f(x, I, n): +    while x[-1] <= n: +        a = [x[I[0]] * 2, x[I[1]] * 3, x[I[2]] * 5] +        b = min(a) +        c = a.index(b) +        if b > x[-1]: +            x += [b] +        I[c] += 1 +    return -M = [] -N = [] -    M.append(m) -    N.append(n) -H = hum(max(N)) -for m, n in zip(M, N): -    print(sum(H[m : n + 1])) +    x = [1] +    I = [0, 0, 0] +    f(x, I, m - 1) +    a = len(x) +    f(x, I, n) +    print(len(x) - a)