#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[10];
bool check(int x){
	int tot=0;
	while(x){
		a[++tot]=x%10;
		x/=10;
	}
	sort(a+1,a+tot+1);
	for(int i=1;i<=tot;i++){
		if(a[i]!=i-1) return 0;
	}
	return 1;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int l,r;
	cin>>l>>r;
	int ans=0;
	for(int i=l;i<=r;i++) ans+=check(i);
	cout<<ans;
	return 0;
}