#include<bits/stdc++.h> 
using namespace std;
#define int long long
const int M=1e6+10;
int l,r,cnt=0;
bool vh[M];

signed main(){
	cin>>l>>r;
	for(int i=l;i<=r;++i){
		cnt++;
		int p1=i,c=0,p2=i;
		while(p1){
			c++;
			p1/=10;
		}
		fill(vh,vh+c,0);
		while(p2){
			if(vh[p2%10]||p2%10>=c){
				cnt--;
				break;
			}
			vh[p2%10]=1;
			p2/=10;
		}
	}
	cout<<cnt<<endl;
	return 0;
}