#include <iostream>
using namespace std;

int humming[1000001];
void hum(void)
{
  int i;
  int f, c;
  for (i = 1; i <= 1000000; i++){
    c = i;
    while (1){
      f = 0;
      if (c % 2 == 0){
        c /= 2;
        f++;
      }
      if (c % 3 == 0){
        c /= 3;
        f++;
      }
      if (c % 5 == 0){
        c /= 5;
        f++;
      }
      if (f == 0){
        break;
      }
    }
    if (c == 1){
      humming[i] = 1;
    } else {
      humming[i] = 0;
    }
  }
}

int main(void)
{
  hum();
  int m, n;
  int cut;
  int i;

  while (1){
    cin >> m;
    if (m == 0){
      break;
    }
    cin >> n;
    cut = 0;
    for (i = m; i <= n; i++){
      cut += humming[i];
    }
    cout << cut << endl;
  }

  return (0);
}