#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1e9 + 7;
const int INF = (int)2e9 + 7;
const long long LINF = (long long)1e18;
const unsigned long long mod1 = 183453789;
const unsigned long long mod2 = 1234567891;
const int P1 = 337, P2 = 263;
template<typename T>
T input(){
T ans = 0, m = 1; char c = ' ';
while (!((c >= '0' && c <= '9') || c == '-')) c = getchar();
if (c == '-') m = -1, c = getchar();
while (c >= '0' && c <= '9') ans = ans * 10 + (c - '0'), c = getchar();
return ans * m;
}
string nextString(bool flag = false){
char ch; string ans = "";
do { ch = getchar(); } while(ch <= ' ');
while(1) {
ans += ch; ch = getchar();
if ( (!flag && ch <= ' ') || (flag && ch < ' ') ) break;
}
return ans;
}
char nextChar(){
char ch;
do {ch = getchar(); } while(ch <= ' ');
return ch;
}
void read(string& s){ s = nextString(); }
void read(char& c){ c = nextChar(); }
template<typename T> void read(T& a){ a = input<T>(); }
template<typename T, typename... R> void read(T& a, R&... r){ read(a); read(r...); }
const int N = 1e5 + 10;
int f[N];
int solve(const string& s){
if (s == "0") return 0;
int n = s.size();
int res = 0;
res += f[n - 1];
vector < string > vec;
for (int s = 1; s <= 9; ++ s){
for (int d = 0; d < 10; ++ d){
string t;
t += char('0' + s);
for (int i = 1; i < n; ++ i){
char nxt = ((t[i - 1] - '0') + d) % 10 + '0';
t += nxt;
}
if (d > 0 && n == 1) continue;
vec.push_back(t);
}
}
for (const auto& x: vec){
res += (x <= s);
}
return res;
}
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#else
freopen("arithnumbers.in", "r", stdin);
freopen("arithnumbers.out", "w", stdout);
#endif
f[0] = 0, f[1] = 9;
for (int i = 2; i < N; ++ i){
f[i] = f[i - 1] + 90;
}
string l, r;
read(l, r);
auto decrease = [](string& s){
if (s == "1"){
s = "0";
return;
}
int n = s.size();
int ptr = n - 1;
while (s[ptr] == '0'){
s[ptr] = '9';
ptr --;
}
s[ptr] --;
if (s[0] == '0') s = s.substr(1);
};
decrease(l);
cout << solve(r) - solve(l);
}