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

bool vis[10];

bool check(int n)
{
	int bit = 0;
	memset(vis, 0, sizeof vis);
	while (n)
	{
		int ge = n % 10;
		bit++;
		if (vis[ge] == 1) return 0;
		vis[ge] = 1;
		n /= 10;
	}
	for (int i = 0; i < bit; i++)
		if (!vis[i]) return 0;
	return 1;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	int ans = 0;
	if (a > b) swap(a, b);
	for (int i = a; i <= b; i++)
		if (check(i)) ans++;
	cout << ans << '\n';
	return 0;
}