#include<bits/stdc++.h>
using namespace std;
bool fun(int n)
{
	int i=0;
	int x=n;
	int a[20];
	while(x!=0)
	{
		a[i]=x%10;
		x/=10;
		i++;
	}
	sort(a,a+i);
	for(int j=0;j<i;j++)
	{
		if(a[j]!=j)
		{
			return false;
			
		}
	}
	return true;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); 
	int a,b,cnt=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		int x=i;
		if(fun(i)==true)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}