#include<bits/stdc++.h>
using namespace std;
bool pd_luck(int t)
{
	bool td[15]={false};
	int ws=0,wsn=1;
	int dt=t;
	while(t!=0)
	{
		int g=t%10;
		ws++;
		t/=10;
	}
	while(dt!=0)
	{
		int g=dt%10;
		if(td[g]==true||g>=ws)
		{
			return false;
		}
		else
		{
			td[g]=true;
			wsn++;
		}
		dt/=10;
	}
	for(int i=0;i<=ws-1;i++)
	{
		if(td[i]==false)
			return false;
	}
	return true;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int ans=0;
	int a,b; 
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(pd_luck(i)==true)
		{
			ans++;	
		}
	}
	cout<<ans;
	return 0;
}