#include <bits/stdc++.h>
using namespace std;

bool vis[8];
bool ch(int x)
{
	int xt = x;
	int count = 0;
	while(x != 0)
	{
		count++;
		x /= 10;	
	}
	int c = 0, res;
	for(int i = 0; i <= count - 1; i++)
	{
		vis[i] = 0;
	}
	while(xt != 0)
	{
		res = xt % 10;
		for(int i = 0; i <= count - 1; i++)
		{
			if(res == i && vis[i] == 0) 
			{
				c++;
				vis[i] = 1;
			}
		}
		xt /= 10;
	} 
	if(c == count) return true;
	else return false;
}

int main()
{
	int a, b, cnt = 0;
	cin >> a >> b;
	for(int i = a; i <= b; i++)
	{
		if(ch(i)) cnt++;
	}
	cout << cnt;
	return 0;	
}