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

int a,b,cnt = 0;

bool vis[10];

int lon(int h)
{
	int longh = 0;
	while(h > 0)
	{
		longh++;
		h /= 10;
	}
	return longh;
}

void dfs(int x,int nlon)
{
	if(lon(x) == nlon)
	{
		if(a <= x && x <= b)
		{
			//cout << x << "\n";
			cnt++;
		}
		return ;
	}
	for(int i = 0;i < nlon;i++)
	{
		if(x == 0 && i == 0)
		{
			continue;
		}
		if(vis[i])
		{
			continue;
		}
		vis[i] = 1;
		dfs(x * 10 + i,nlon);
		vis[i] = 0;
	}
}

int main()
{
	cin >> a >> b;
	int al = lon(a),bl = lon(b);
	for(int i = al;i <= bl;i++)
	{
		dfs(0,i);
	}
	cout << cnt << "\n";
	return 0;
}