1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>

int is_valid(long long n) {
    long long temp = n;
    while (temp > 0) {
        int last_digit = temp % 10;
        if (last_digit == 0 || n % last_digit != 0) {
            return 0;
        }
        temp /= 10;
    }
    return 1;

}

int main() {
    long long l, r;
    std::cin >> l >> r;
    long long valid = 0;
    for (long long i = l; i <= r; ++i) {
        valid += is_valid(i);
    }
    std::cout << valid << std::endl;
    return 0;
}