#include<bits/stdc++.h>
using namespace std;
#define debug(n,m) cout<<"["<<#n<<"]->"<<n<<m
#define ll long long
//#define int long long
#define all(x,off) x.begin()+off,x.end()
#define pb push_back
const int N=5e5+10;
const ll inf=9e17;
const ll mod=1e9+7;
bool check(int n) {
string s=to_string(n);
int m=s.size();
s='!'+s;
for (int i=2;i<=m;++i) {
if (i>=3) {
if (s[i]==s[i-2]) return 0;
}
if (s[i]==s[i-1]) return 0;
}
return 1;
}
void levi() {
int l,r;
cin>>l>>r;
int res=0;
for (int i=l;i<=r;++i ){
if (check(i))++res;
}
cout<<res<<'\n';
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);int tt=1;//cin>>tt;
while (tt--) levi();
}