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

bool solve(int t) {
	int cnt = 0;
	vector <int> v;
	while(t != 0) {
		v.push_back(t % 10);
		t /= 10;
		cnt++;
	}
	sort(v.begin(), v.end());
	for(int i = 0; i < cnt; i++) 
		if(v[i] != i) 
			return false;
	return true;
}

int main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	for(int i = a; i <= b; i++) 
		ans += (solve(i) == true);
	cout << ans;
	
	return 0;
}