#include <bits/stdc++.h>
using namespace std;
#define int long long
int a,b;
int ans;
int q[1000005];
int ws(int t){
	int ans=0;
	while(t!=0){
		ans++;
		t/=10;
	}
	return ans;
}
bool check(int t,int p){
	memset(q,0,sizeof(q));
	while(t!=0){
		int g=t%10;
		q[g]++;
		t/=10;
	}
	for(int i=0;i<p;i++){
		if(q[i]!=1) return false;
	}
	return true;
}
signed main(){
	ios::sync_with_stdio();
	cin.tie(0); cout.tie(0);
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		int s=ws(i);
		if(check(i,s)) ans++;
	}
	cout<<ans;
	return 0;
}