#include <iostream>
#include <cstring>
using namespace std;
int memo[1000000];

int solve( int ,int ,int );
int main(){
  int n ,m ,total;
  while( true ){
    total = 0;
    memset( memo ,-1 ,sizeof( memo ) );
    cin >> n;
    if( n == 0 ) break;
    cin >> m;
    solve( 1 ,n ,m );
    for( int i=n-1 ; i<=m ; i++ ){
      if( memo[i] != -1 ) total++;
    }
    cout << total << endl;
  }
}

int solve( int ans ,int n ,int m ){
  if( ans <= m ){
    if( n <= ans && memo[ans] == -1) return memo[ans] = ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +
							  solve( ans*5 ,n ,m ) );
    else return ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +  solve( ans*5 ,n ,m ) );
  }
  else return 0;
}