#include <iostream>
using namespace std;

int main(void){
  bool ishammingNumber[1000001] = {false, true, true, true, true, true};
  for(int i = 6; i <= 1000000; i++){
    if((i % 2 == 0 && ishammingNumber[i/2]) || (i % 3 == 0 && ishammingNumber[i/3]) || (i % 5 == 0 && ishammingNumber[i/5])) ishammingNumber[i] = true;
    else ishammingNumber[i] = false;
  }
  int m, n, cnt;
  while(cin >> m && m != 0 && cin >> n){
    cnt = 0;
    for(int i = m; i <= n; i++) if(ishammingNumber[i]) cnt++;
    cout << cnt << endl;
  }
  return 0;
}