#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,t=0,i1,t1=0;
	int cnt=0,tr=0;
	int w[7]={0};
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		i1=i;
		t=0;tr=0,t1=0;
		while(i1){
			w[t1]=i1%10;
			t++;
			t1++;
			i1/=10;
		}
		sort(w,w+t-1);
		for(int j=1;j<=t;j++){
			if(w[t-j]!=t-j) continue;
			tr++;
		}
		if(tr==t) cnt++;
		
	}
	cout<<cnt;
	
	
	return 0;
}