#include<iostream>
using namespace std;

int main(){
  bool data[1000001];
  int n,m,k,count;

  for(int i = 0;i < 1000001;i++){
    k = i;
    while(k%2 == 0&&k >=2)k /= 2;
    while(k%3 == 0&&k >=3)k /= 3;
    while(k%5 == 0&& k >= 5)k /= 5;
    if( k == 1)
      data[i] = true;
    else
      data[i] = false;
  }

  while(1){
    cin >> m;
    if(m == 0)break;
    cin >> n;
    count = 0;
    for(int i = m; i <= n;i++)
      if(data[i] == true)count++;

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