#include<bits/stdc++.h>
#define cst const
#define csti const int
#define rep(i,l,r) for(int (i)=(l);(i)<=(r);++(i))
#define per(i,l,r) for(int (i)=(l);(i)>=(r);--(i))
#define pii pair<int,int>
#define eb emplace_back
#define fi first
#define se second
#define il inline
//#define int long long
//#define LOL
#ifdef LOL
csti inf=0x3f3f3f3f3f3f3f3f;
#else
csti inf=0x3f3f3f3f;
#endif
csti N=1e6+7,mod=1;
il int max(csti x,csti y){
	return x>y?x:y;
}
il int min(csti x,csti y){
	return x<y?x:y;
}
il int abs_(csti x){
	return x<0?-x:x;
}
using namespace std;

int l,r;
il bool solve(int x){
	int z=x;
	int cnt=0;
	while(z){
		cnt++,z/=10;
	}string s=to_string(x);
	sort(s.begin(),s.end());
	csti R=s.size()-1;
	rep(i,0,R){
		if(s[i]!=char('0'+i))return false;
	}return true;
}
signed main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	//freopen(".in","r",stdin),freopen(".out","w",stdout);
	cin>>l>>r;
	int ans=0;
	rep(i,l,r){
		
		ans+=solve(i);
	}cout<<ans;
	return 0;
}