#include <iostream>
using namespace std;

bool isHamming(int x){
  while(x % 2 == 0) x /= 2;
  while(x % 3 == 0) x /= 3;
  while(x % 5 == 0) x /= 5;
  return x == 1;
}

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

    int ans = 0;

    for(int i = m; i <= n; i++){
      if(isHamming(i)){
        ans++;
      }
    }

    cout << ans << endl;
  }
}