#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int a,b,s[10],tot;
bool f[10];

int main() {
	scanf("%d%d",&a,&b);
	int cnt = 0;
	for (int i=a;i<=b;i++) {
		tot = 0;
		for (int j=1;j<=7;j++)
			s[j] = 0;
		for (int j=0;j<=9;j++)
			f[j] = 0;
		int x = i;
		while (x > 0) {
			s[++tot] = x % 10;
			x /= 10;
		}
		bool ok = 1;
		for (int j=1;j<=tot&&ok;j++)
			if (s[j] >= tot)
				ok = 0;
		if (ok) {
			for (int j=1;j<=tot&&ok;j++) {
				if (f[s[j]]) ok = 0;
				else f[s[j]] = 1;
			}
			if (ok) cnt++;
		}
	}
	printf("%d\n",cnt);
}