#include <cstdio>

int ham[1000010];
int sum[1000010];

int main(){
	ham[1] = 1;
	for(int i = 2; i <= 1000000; ++i){
		int t = 0;
		if(i % 2 == 0){ t |= ham[i / 2]; }
		if(i % 3 == 0){ t |= ham[i / 3]; }
		if(i % 5 == 0){ t |= ham[i / 5]; }
		ham[i] = t;
	}
	for(int i = 1; i <= 1000000; ++i){
		sum[i] = sum[i - 1] + ham[i];
	}
	
	int m, n;
	while(scanf("%d%d", &m, &n) == 2){
		printf("%d\n", sum[n] - sum[m - 1]);
	}
}