#include<bits/stdc++.h>
using namespace std;
#define int long long
int Abs(int a){return a>0?a:0-a;}
int a,b,nm[25],dp[25][25];
int dfs(int p,int lst,bool lim,bool led){
if(!p)return 1;
if(!lim&&!led&&dp[p][lst]>-1)return dp[p][lst];
int up=(lim?nm[p]:9),s=0;
for(int i=0;i<=up;i++){
if(!led&&Abs(i-lst)<2)continue;
s+=dfs(p-1,i,lim&&i==up,led&&i==0);
}
if(!lim&&!led)dp[p][lst]=s;
return s;
}
int sol(int x){
int cnt=0;
while(x)nm[++cnt]=x%10,x/=10;
memset(dp,-1,sizeof dp);
return dfs(cnt,-114514,1,1);
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>a>>b;
cout<<sol(b)-sol(a-1);
return 0;
}