#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 6; 
int a, b, x, y, ans, s[] = { 0, 1, 2, 6, 24, 120, 720, 5040, 40320 };
int f[N], t;
void v(int x, int mx) {
	if (x > mx) {
		if (to_string(t).size() == mx && t >= a && t <= b) {
			ans++;
		}
		return;
	}
	for (int i = 0; i < mx; i++) {
		if (f[i] == false) {
			f[i] = true;
			t = t * 10 + i;
			v(x + 1, mx);
			t /= 10;
			f[i] = false;
		}
	}
	
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	for (int i = 1; i <= 8; i++) s[i] = s[i] - s[i - 1];
	cin >> a >> b;
	for (int i = to_string(a).size(); i <= to_string(b).size(); i++)
		v(1, i);
	cout << ans;
	return 0;
}