#include<bits/stdc++.h>
using namespace std;
int n[1000000],c,i,j,a,b,t,s,s1,sl,f;
int main(){
	cin>>a>>b;
	for(i=a;i<=b;i++){
		f=1;
		t=i;
		s=0;
		s1=0;
		c=0;
		while(t>0){
			c++;
			n[t%10]=1;
			s+=t%10;
			t/=10;
		}
		for(j=0;j<c;j++){
			s1+=j;
			if(n[j]!=1){
				f=0;
			}n[j]=0;
		}
		if(s==s1&&f==1){
			sl++;
		}
	}
	cout<<sl;
	return 0;
}