#include <bits/stdc++.h>
using namespace std;

int h(int n)
{
	int s=0;
	while(n!=0)
	{
		s++;
		n/=10;
	}
	return s;
}
bool check(int w,int i)
{
	int f[w];
	for(int j=0;j<w;j++)
	{
		f[j]=0;
	}
	while(i!=0)
	{
		int ge=i%10;
		if(ge>=w)
		{
			return false;
		}
		f[ge]++;
		i/=10;
	}
	for(int j=0;j<w;j++)
	{
		if(f[j]==0 || f[j]>1)
		{
			return false;
		}
	}
	return true;
}
int main()
{
	int a,b;
	cin >>a>>b;
	int nt=0;
	for(int i=a;i<=b;i++)
	{
		int w=h(i);
		if(check(w,i)==true)
		{
			nt++;
		}
	}
	cout <<nt;
	return 0;
}