#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<cmath>#include<cctype>#include<vector>#include<queue>#include<set>#include<list>#include<map>#define fi first#define se second#define pb push_back#define mp make_pairusing namespace std;typedef long long LLL;const double X[] = {0, 1, 1.25, 2, 2.5, 5};int cyh(int n){ int e,ans=0; LLL t=1,pre=0; while(true) { for(e=1; e <= 5; e++) { double x=X[e]*t; if((LLL)(x) > n) return ans; if((LLL)(x) == x && (LLL)(x) != pre) { ans++; pre = (LLL)(x); } } t *= 10; } return ans;}int main(){ int a,b; while(cin >> a >> b) cout << cyh(b)-cyh(a-1) << endl; return 0;}


