#include <bits/stdc++.h> using namespace std; int num[10005], p[15]; int main() { int l, r; scanf("%d %d", &l, &r); int cnt = 0; for (int d = 2; d <= 7; d++) { for (int i = 0; i < d; i++) { p[i] = i; } do { if (p[0]) { int x = 0; for (int i = 0; i < d; i++) { x = x * 10 + p[i]; } num[cnt++] = x; } } while (next_permutation(p, p + d)); } int ans = 0; for (int i = 0; i < cnt; i++) { if (l <= num[i] && num[i] <= r) { ans++; } } printf("%d", ans); return 0; }