#include<bits/stdc++.h>
using namespace std;
int a,b; 
bool check(int x){
	int a[10];
	int tot=1;
	for(;x;x/=10){
		a[tot]=x%10;
		tot++;
	}
	tot--;
	sort(a+1,a+tot+1);
	for(int i=0,j=1;i<tot;i++,j++){
		if(a[j]!=i){
			return false;
		}
	}
	return true;
}
int main(){
	cin>>a>>b;
	int sum=0;
	for(int i=a;i<=b;i++){
		if(check(i)){
			sum++; 
		}
	}
	cout<<sum;
	return 0;
}