#include<bits/stdc++.h>
using namespace std;
int j(int n,int b){
unsigned int i=0,s=0;
while(n){
s+=n%b*pow(10,i++);
n/=b;
}
while(n){
if(n%10==0){
return false;
}
n/=10;
}
return true;
}
int main(){
unsigned int a,b,c=0;
cin>>a>>b;
for(unsigned int i=a;i<=b;i++){
if(j(i,5) && j(i,7) && j(i,9)){
c++;
}
}
cout<<c;
return 0;
}
无语了