#include <bits/stdc++.h>
using namespace std;
long long ans=0,a,b,l=1,h=1,temp1,temp2;
bool check(int i,int u){
	if(i==0) return 0;
	set <int> s;
	int x;
	do{
		x=i%10;
		if(x>=u)return 0;
		s.insert(x);
	}while(i/=10);
	if(s.size()==u) return 1;
	return 0;
}
int main(){
	cin >>a>>b;
	temp1=a;temp2=b;
	while(a/=10){
		l++;
	}
	while(b/=10){
		h++;
		if(b%10==0) b=b+1;
	}
	int t=1;
	for(int i=2;i<h;i++){
		if(i<=l){
			t*=i;
		}
		else{
			ans-=t;
			t*=i;
			ans+=t;
		}
	}
	a=temp1;
	b=temp2;
	for(int i=a;i<pow(10,l);i++){
		if(check(i,l)){
			ans++;
		}
	}
	for(int i=pow(10,h-1)+1;i<=b;i++){
		if(check(i,h)){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}