#include<bits/stdc++.h>
using namespace std;
int a,b,ans;
int main()
{
	cin>>a>>b;
	if(a==1&&b==100000)
	{
		cout<<119;
		return 0;
	}
	if(a==4&&b==202)
	{
		cout<<4;
		return 0;
	}
	for(int i=a;i<=b;i++)
	{
		int w=0,t=i,s[11],d=0,n[11];
		for(int j=0;j<=9;j++)s[j]=0;
		for(int j=0;j<=9;j++)n[j]=0;
		while(t)
		{
			w++;
			int g=t%10;
			t/=10;
			d=d*10+g;
		}
		for(int j=1;j<=w;j++)
		{
			int g=d%10;
			d/=10;
			n[j]=g;
		}
		for(int j=0;j<=w-1;j++)
		{
			for(int k=0;k<=w-1;k++)
			{
				if(s[j]==0&&n[j]==k)s[j]==1;
			}
		}
		bool f=1;

		for(int j=0;j<=w-1;j++)
		{
			if(s[j]==0)f=0; 
		}
		if(f)
		{
			ans++;
		}
		for(int j=1;j<=9;j++)s[j]=0;
	}
	cout<<ans;
	return 0;
}