#include <cstdio>
#include <bitset>
using namespace std;

#define MAX 1000001
bitset<MAX> bs;
int mul[3] = { 2,3,5 };

int main(){
	bs.set(1);
	int p;
	for (int i = 0; i < MAX; i++) {
		if (bs[i]) {
			for (int j = 0; j < 3; j++) {
				p = i*mul[j];
				if (p < MAX) {
					bs.set(p);
				}
			}
		}
	}
	int m, n, c;
	while (scanf("%d", &m), m != 0) {
		scanf("%d", &n);
		c = 0;
		for (int i = m; i <= n; i++) {
			if (bs[i])c++;
		}
		
		printf("%d\n", c);
	}
	
	return 0;
}