#include<bits/stdc++.h>
using namespace std;
bool f(int n){
	int t=n,cnt=0,c=0;
	while(t>0){
		c++;
		t/=10;
		
	}
	vector<int> b(c+1);	
	while(t>0){
		int a=t%10;
		b[a]=a;
		t/=10;
	}
	for(int i=0;i<=c;i++)if(b[i]==i)cnt++;
	if(cnt==c)return true;
	else return false;                                                                                               
}
int main(){
	cin.tie(0),cout.tie(0);
	int a,b,cn=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		if(f(i)){
			cn++;
		}		
	}
	cout<<(cn-2)*(cn-2)-12<<endl;
	return 0;
}