#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1000002;
int S[MAXN], T[MAXN];

int main() {
  S[1] = 1;
  for(int i = 0; i*2 < MAXN; ++i) S[i*2] += S[i];
  for(int i = 0; i*3 < MAXN; ++i) S[i*3] += S[i];
  for(int i = 0; i*5 < MAXN; ++i) S[i*5] += S[i];
  for(int i = 0; i+1 < MAXN; ++i) S[i+1] += S[i];
  int n, m;
  while(cin >> m && m) {
    cin >> n;
    cout << S[n] - S[m-1] << endl;
  }
  return 0;
}