#include<iostream>
using namespace std;
int a[1000001]={0};
int main(void){
  a[1]=1;
  for(int i=1;i<=1000000;i++){
    if(a[i] && i*2<=1000000) a[i*2]=1;
    if(a[i] && i*3<=1000000) a[i*3]=1;
    if(a[i] && i*5<=1000000) a[i*5]=1;
  }
  int n,m;
  while(cin >> n,n){
    cin >> m;
    int c=0;
    for(int i=n;i<=m;i++){
      if(a[i]) c++;
    }
    cout << c << endl;
  }
}
