#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX 1000001

int h[MAX];

int main(){
  for(int i=1; i<MAX; i*=2)
    for(int j=i; j<MAX; j*=3)
      for(int k=j; k<MAX; k*=5)
        h[k] = 1;
  int a,b;
  while(scanf("%d",&a),a){
    int ans = 0;
    scanf("%d",&b);
    while(a <= b) ans += h[a++];
    printf("%d\n",ans);
  }
  return 0;
}