#include <iostream>
using namespace std;

int count1=0;
void rec(string S,int b,int i)
{
	//cout<<"S="<<S<<endl;
	
	string S2 = to_string(b);
	if(i == S2.length())
	{
		if(S != "" && stoi(S) <= b)
		{
			count1++;
		}
		return;
	}
	else
	{
		if(i == 0)
		{
			for(int j=0;j<10;j++)
			{
				if(j ==0 && S=="")
				{
					rec(S,b,i+1);
				}
				else
				{
					string s = S;
					s+=(j+'0');
					rec(s,b,i+1);
				}
			}
		}
		else
		{
			for(int j=0;j<10;j++)
			{
				if(S.back() != (j+'0'))
				{
					if(j ==0 && S=="")
					{
						rec(S,b,i+1);
					}
					else
					{
						string s = S;
						s+=(j+'0');
						rec(s,b,i+1);
					}
				}
			}
		}
	}
}

int main() {

	long long a,b;
	cin>>a>>b;

	count1=0;
	rec("",b,0);
	int countb=count1;	
	
	count1=0;
	rec("",a-1,0);
	int counta=count1;

	cout<<countb-counta<<endl;

	return 0;
}