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 <bits/stdc++.h>
using namespace std;

bool chk(long long b) {
  long long a = b;
  while(a > 0) {
    if(a % 10 == 0 || b % (a % 10) != 0) return false;
    a /= 10;
  }
  return true;
}

int main() {

  long long l, r;
  scanf("%lld %lld", &l, &r);

  long long s = 0;
  for(; l <= r; l++) {
    if(chk(l)) s++;
  }

  printf("%lld", s);

}