#include <bits/stdc++.h>
using namespace std;
bool a[5000001] = {};

int main(){

  a[1] = true;
  for(int i=1;i<=1000000;i++){
    if(a[i]){
      a[i*2]=true;
      a[i*3]=true;
      a[i*5]=true;

    }
  }
  //for(int j = 2; j < 1000001; j+=2) a[j] = true;
  //for(int j = 3; j < 1000001; j+=3) a[j] = true;
  //for(int j = 5; j < 1000001; j+=5) a[j] = true;

  while(1){
    int m,n;
    cin >> m; if(m == 0)break;
    cin >> n;

    int count = 0;

    for(int i = m; i <= n; i++){
      if(a[i] == true)count++;
    }

    cout << count << endl;
  }
  return 0;
}

