#include<bits/stdc++.h>
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define dbg(a,i,n) printf("%d %c",a," \n"[i==n])
using namespace std;
const int inf=0x3f3f3f3f;
const ll linf=(1ll<<62)-1;
const int N=3e5+7;
const int M=2e6+7;
const int mod=1e9+7;
template <typename T>inline void rd(T &x){
char c;int sign=1;x=0;
do{c=getchar();if(c=='-')sign=-1;}while(c<'0'||c>'9');
do{x=x*10+c-'0';c=getchar();}while(c>='0'&&c<='9');
x*=sign;
}
int l,r,p;
int num[100], f[30][100][100];
ll dfs(int len, int sum, int mod, bool limit){
if(!len) {
if(sum == p && !mod) return 1;
return 0;
}
if(f[len][sum][mod] != -1 && !limit) return f[len][sum][mod];
ll ans = 0;
int up = limit? num[len]: 9;
for(int i = 0; i <= up; i++)
ans += dfs(len-1, sum+i, (mod*10+i)%p, limit && i == up);
return limit? ans: f[len][sum][mod] = ans;
}
ll solve(int n){
int k = 0;
while(n){
num[++k] = n%10;
n /= 10;
}
ll ans = 0;
for(p = 1; p < 100; p++){
clr(f,-1);
ans += dfs(k, 0, 0, 1);
}
return ans;
}
int main(){
rd(l);rd(r);
printf("%lld\n",solve(r) - solve(l-1));
return 0;
}