#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int a[10000001],s[10000001],used[10];
void dfs(int x,int step,int num)
{
	if(step>x)
	{
		a[num]=1;
	 } 
	if(step==1)
	{
		for(int i=1; i<x; i++)
		{
			used[i]=1;
			dfs(x,step+1,num*10+i);
			used[i]=0;
		}
	}
	else
	{
		for(int i=0; i<x; i++)
		{
			if(!used[i])
			{
				used[i]=1;
				dfs(x,step+1,num*10+i);
				used[i]=0;
			}
		}
	}
}
void init()
{
	dfs(1,1,0);
	dfs(2,1,0);
    dfs(3,1,0);
    dfs(4,1,0);
	dfs(5,1,0);
	dfs(6,1,0);
	dfs(7,1,0);
	for(int i=1; i<=1000000; i++)
	{
		s[i]=s[i-1]+a[i];
	} 
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	init();
	int x,y;
	cin>>x>>y;
	cout<<s[y]-s[x-1];
	return 0;
}