#include <iostream>
using namespace std;
bool a[1000001];
int main()
{
  int i,j,m,n;
  for(i=1;i<1000001;i++){
    j = i;
    while(j % 2 == 0) j /= 2;
    while(j % 3 == 0) j /= 3;
    while(j % 5 == 0) j /= 5;
    if(j==1) a[i] = true;
  }
  for(;;){
    cin >> m;
    if(m==0) break;
    cin >> n;
    j = 0;
    for(i=m;i<=n;i++){
      if(a[i]) j++;
    }
    cout << j << endl;
  }
  return 0;
}