#include<bits/stdc++.h>
using namespace std;
bool l(int n){
	while(n){
		int g=n%10;
		if(g==0)return 1;
		n/=10;
	}
	return 0;
}
bool y(int n){
	while(n){
		int g=n%10;
		if(g==1)return 1;
		n/=10;
	}
	return 0;
}
bool e(int n){
	while(n){
		int g=n%10;
		if(g==2)return 1;
		n/=10;
	}
	return 0;
}
bool sa(int n){
	while(n){
		int g=n%10;
		if(g==3)return 1;
		n/=10;
	}
	return 0;
}
bool si(int n){
	while(n){
		int g=n%10;
		if(g==4)return 1;
		n/=10;
	}
	return 0;
}
bool w(int n){
	while(n){
		int g=n%10;
		if(g==5)return 1;
		n/=10;
	}
	return 0;
}
int ws(int n){
	int cnt=0;
	while(n){
		n/=10;
		cnt++;
	}
	return cnt;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int a,b,s=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		if(ws(i)==2){
			if(l(i)&&y(i))s++;
		}
		if(ws(i)==3){
			if(l(i)&&y(i)&&e(i))s++;
		}
		if(ws(i)==4){
			if(l(i)&&y(i)&&e(i)&&sa(i))s++;
		}
		if(ws(i)==5){
			if(l(i)&&y(i)&&e(i)&&sa(i)&&si(i))s++;
		}
		if(ws(i)==6){
			if(l(i)&&y(i)&&e(i)&&sa(i)&&si(i)&&w(i))s++;
		}
	}
	cout<<s;
	return 0;
}