#include <iostream> #include <cstring> #include <cmath> using namespace std; bool book[10]; bool lucky(int n){ int l = 0, maxn = -1; while (n){ if (book[n % 10]){ memset(book, 0, sizeof(book)); return false; } book[n % 10] = true; maxn = max(maxn, n % 10); n /= 10; l++; } memset(book, 0, sizeof(book)); return maxn == l - 1; } int main(){ int a, b, num = 0; cin >> a >> b; for (int i = a;i <= b;i++){ if (lucky(i)){ num++; } } cout << num; }