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

string a[1000010];
int check1(string s) {
	int l = s.length();
//	cout << s;
	for (int i = 0; i < l; i++) a[i] = s[i];
//	for (int i = 0; i < l; i++) {
//		cout << a[i] << ' ';
//	}
	sort(a, a+l);
	for (int i = 0; i < l; i++) {
		if (a[i] != to_string(i))
			return 0;
		}
	return 1;
}

int check2(string s) {
	if (s[0] == 0) {
		return 0;
	}
	return 1;
}

int main() {
	int a, b; cin >> a >> b;
	int cnt = 0;
	for (int i = a; i <= b; i++) {
		string s = to_string(i);
		if (check1(s) == 1 && check2(s) == 1) {
			cnt ++;             
		}
	}
	cout << cnt;
	
	return 0;
}