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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define PB emplace_back
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int,int>;
using pll = pair<ll,ll>;

constexpr int IN = 1000005;
constexpr int INF = 1e9+5;
constexpr int INI = -1;

bool pot(ll x){
    ll ans = 0;
    vi cyfry;
    ll l = x;
    while(l!=0){
        ll tmp = l % 10;
        if(tmp == 0)
            return false;
        cyfry.PB(tmp);
        l /= 10;
    }
    for(auto u: cyfry){
        if(x % u != 0)
            return false;
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll l, r;
    cin >> l >> r;
    ll ans = 0;
    for(ll i=l; i<=r; ++i){
        if(pot(i)){
           // cout << i << endl;
             ++ans;
        }
    }
    cout << ans;
    return 0;
}