#include <cstdio>
#include <cstring>
#include <iostream>
typedef long long LL;
LL pow[20], f[20][165][165][2];
bool vis[20][165][165][2];
inline LL dfs(int pos, int tot, int rem, bool lim, int sum ,LL num){
if (vis[pos][tot][rem][lim])
return f[pos][tot][rem][lim];
vis[pos][tot][rem][lim] = true;
f[pos][tot][rem][lim] = 0;
if(pos == 0) return f[pos][tot][rem][lim] = ((rem == 0) && (tot == sum));
for (int i = 0; i < 10; i++){
int c = num / pow[pos - 1] % 10;
if (i + tot > sum || lim && c < i) break;
LL tmp = dfs(pos - 1, tot + i, (rem * 10 + i) % sum, lim && c == i, sum ,num);
f[pos][tot][rem][lim] += tmp;
}
return f[pos][tot][rem][lim];
}
inline LL calc(LL x) {
LL rtn = 0;
for (int i = 1; i <= 162; i++) {
memset(vis, false, sizeof(vis));
rtn += dfs(19, 0, 0, true, i, x);
}
return rtn;
}
int main(){
#ifdef YSW
freopen("data.in", "r", stdin);
#endif
pow[0] = 1;
for(int i = 1; i <= 19; i++) pow[i] = pow[i-1] * 10;
LL l, r; scanf("%lld%lld", &l, &r);
printf("%lld", calc(r) - calc(l - 1));
return 0;
}