Go: package main

import (
	"bufio"
	"os"
		"strings"
	"strconv"
			"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)
const (
	MAX = 1000000
)
func main() {
	a := make([]int, MAX+1)
	a[1] = 1
	for i := 2; i <= MAX; i *= 2 {
		a[i]++
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*3; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*5; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		m, _ := strconv.Atoi(buf[0])
		if m == 0 {
			break
		}
		n, _ := strconv.Atoi(buf[1])
		cnt := 0
		for i := m; i <= n; i++ {
			if a[i] != 0 {
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

C++: #include<iostream>
using namespace std;
 
int dp[1000001] = {0};
int main() {
        int a=1,n,m;
        for(int i = 0 ; a <= 1000000 ; i++){
                int b = 1;
                for(int j = 0 ; a*b <= 1000000 ; j++){
                        int c = 1;
                        for(int k = 0 ; a*b*c <= 1000000 ; k++){
                                dp[a*b*c] = true;
                                c *= 5;
                        }
                        b *= 3;
                }
                a *= 2;
        }
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i] += dp[i-1];
        }
        while(cin >> m&&m){
                cin >> n;
                cout << dp[n] - dp[m-1] << endl;
        }
        return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 1000000 + 10;

bool ham[MAXN];

int main()
{
    ham[1] = 1;
    REP(MAXN)if(ham[i])
    {
        for(int j=i*2; j<MAXN;j*=2)ham[j] = 1;
        for(int j=i*3; j<MAXN;j*=3)ham[j] = 1;
        for(int j=i*5; j<MAXN;j*=5)ham[j] = 1;
    }
    int m, n;
    while(cin >> m && m)
    {
        cin >> n;
        int ans = 0;
        for(int i = m;i<=n;i++)if(ham[i])ans++;
        cout << ans << endl;
    }

    return 0;
}

C++: #include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main(){
	long long int A,B;
	int n[101][101][3]={};
	while(1){
		cin>>A;if(A==0)break;
		cin>>B;long long int g=60;
		/*
		for(int i=1;i<A;i++){
			g*=60;
			cout<<g<<endl;
		}
		*/

		
		int c=0;
		for(long long int i=A;i<=B;i++){g=60;
		for(long long int j=1;j<11;j++)
		{
			if(g%i==0){//cout<<g<<endl;
	//		cout<<i<<endl;
				c++;break;}
		else{g*=60;}
		}
		}
		cout<<c<<endl;
		
	}
	return 0;
}

C++: #include<iostream>
#include<set>
#include<string>
using namespace std;
int main() {
	set<long long>a;
	long long b, c,sum = 1;
	for (int i = 0; i <= 19; i++) {
		b = sum;
		for (int j = 0; j <= 12; j++) {
			c = sum;
			if (sum > 1000000)
				break;
			for (int z = 0; z <= 8; z++) {
				a.insert(sum);
				if (sum > 1000000)
					break;
				sum *= 5;
			}
			sum = c;
			sum *= 3;
		}
		sum = b;
		sum *= 2;
	}
	int m, n,o=0;
	string d, h = "";
	while (getline(cin, d)) {
		o = 0;
		if (d.length() == 1) break;
		d += " ";
		h = "";
		for (int i = 0; i < d.length(); i++) {
			if (d[i] == ' ') {
				if (o == 0){ m = atoi(h.c_str());}
				else {n = atoi(h.c_str());}
				o++;
				h = "";
			}
			else
				h += d[i];
		}
		set<long long>::iterator it = a.begin();
		int sum = 0;
		while ((*it) < m) {
			it++;
			if (it == a.end()){ break;}
		}
		while ((*it) >= m && (*it) <= n)
		{
			it++;
			sum++;
			if (it == a.end()) {break;}
		}
		cout << sum << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

/*ll n, m;
ll a[1000100];

int main(){
	REP(i, 18){
		REP(j, 12){
			REP(k, 9){
				ll b = pow(2, i), d = pow(3, j), e = pow(5, k);
				if (b*d*e <= 1000000){
					a[b*d*e] = 1;
				}
			}
		}
	}
	while (cin >> m){
		if (m == 0)break;
		cin >> n;
		ll c = 0;
		FOR(i, m, n + 1){
			if (a[i]){
				c++;
			}
		}
		cout << c << endl;
	}
}*/


ll n, m;

int main(){
	while (cin >> m){
		if (m == 0)break;
		cin >> n;
		ll c = 0, x = pow(60.0, 10.0);
		FOR(i, m, n + 1){
			if (x % i == 0){
				c++;
			}
		}
		cout << c << endl;
	}
}

C++: #include<stdio.h>
int main()
{
	int m,n,c,s2,s3,s5;
	while(scanf("%d",&m),m)
	{
		scanf("%d",&n);
		c=0;
		for(s2=1; s2<=n; s2*=2)
			for(s3=1; s2*s3<=n; s3*=3)
				for(s5=1; s2*s3*s5<=n; s5*=5)
					if(s2*s3*s5 >= m) c++;
		printf("%d\n",c);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int main()
{
  while (true)
  {
    int m, n;
    cin >> m;
    if ( m == 0 ) break;
    cin >> n;
    
    int count = 0;
    for (int i=m; i<=n; i++)
    {
      int num = i;
      while ( num % 2 == 0 )
      {
        num /= 2;
      }
      while ( num % 3 == 0 )
      {
        num /= 3;
      }
      while ( num % 5 == 0 )
      {
        num /= 5;
      }
      if ( num == 1 )
      {
        count++;
      }
    }
    cout << count << endl;
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>


using namespace std;

bool f[10000002];

int main(){
	
	f[2]=true;f[3]=true;f[5]=true;

	for(int i=2;i<10000001;i*=2)
	{
		f[i]=true;
	}
	//cout<<"#";
	for(int i=3;i<10000001;i*=3)
	{
		f[i]=true;
	}
	for(int i=5;i<10000001;i*=5)
	{
		f[i]=true;
	}
	for(int i=2;i<10000001;i++)
	{
		if(f[i]==true){
		for(int j=i;j<10000001;j*=5)
		f[j]=true;
		for(int j=i;j<10000001;j*=3)
		f[j]=true;
		for(int j=i;j<10000001;j*=2)
		f[j]=true;
			}
	}

	int a,b;

	while(1){
		int ans=0;
		cin>>a;if(a==0)break;
		cin>>b;
		
		for(int i=a;i<=b;i++)
			if(f[i]==true){ans++;}//cout<<i<<endl;}

		cout<<ans<<endl;
	}


	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


const int MAX = 1048576;
bool HammingTable[MAX];

void init()
{
	for(int two = 1; two < MAX; two *= 2)
		for(int three = 1; two * three < MAX; three *= 3)
			for(int five = 1; two * three * five < MAX; five *= 5)
				HammingTable[two * three * five] = true;
}

int main()
{
	init();
    for(int m, n; cin >> m && m && cin >> n; cout << count(HammingTable + m, HammingTable + n + 1, true) << endl);
}