//35
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  static bool hm[1000001]={false,true};
  for(int i=0;i<=1000000;i++){
    for(int j=0;j<3;j++){
      int f[]={2,3,5};
      if(hm[i]&&i*f[j]<=1000000){
	hm[i*f[j]]=true;
      }
    }
  }
  for(int m,n;cin>>m>>n;){
    cout<<count(hm+m,hm+n+1,true)<<endl;
  }
  return 0;
}