#include <bits/stdc++.h>
using namespace std;
int a[1000005];
bool dxs(int n) 
{
	int s=0;
	while(n>0) 
	{
		s=s*10+n%10;
		n/=10;
	}
	if(s==n) return 1;
	return 0;
}
bool pd(int n) 
{
	int ws=0;
	while(n>0) 
	{
		ws++;
		a[ws]=n%10;
		n/=10;
	}
	int jsq=0;//1023
	for(int k=ws-1;k>=0;k--) 
	{
		for(int j=ws;j>=1;j--) 
		{//λÊý£¨1:3£¬2:2£¬3:0£¬4:1£© 
			if(k==a[j])
			{
				jsq++;
			}
			if(a[j]==a[j+1]) return 0;
		}
		
	}
		
		
	if(jsq==ws) return 1;
	return 0;
}
signed main() {
	int a,b;
	cin>>a>>b;
	int cnt=0;
	for(int i=a;i<=b;i++) 
	{
		if(dxs(i)==0) 
		{
			if(pd(i)==1)
			{
				cnt++;
				//cout<<i<<endl;
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}