#include <bits/stdc++.h>
using namespace std;
long long Mod = 1e9 + 7;
long long poww(long long a, long long b, long long mod) {
  long long res = 1;
  if (b < 0) b = (b % (mod - 1) + mod - 1) % (mod - 1);
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
void Max(long long& x, long long y) { x = max(x, y); }
void Min(long long& x, long long y) { x = min(x, y); }
long long Add(long long x, long long y) {
  x %= Mod;
  y %= Mod;
  return (x + y) % Mod;
}
long long Sub(long long x, long long y) {
  x %= Mod;
  y %= Mod;
  return (x - y + Mod) % Mod;
}
long long Mul(long long x, long long y) {
  x %= Mod;
  y %= Mod;
  return (x * y) % Mod;
}
const long long N = 500500, K = 17, Inf = 4e18;
long long l, r;
long long p[20], p9[20];
long long LOG(long long x) {
  long long Res = 0;
  while (x) {
    Res++;
    x /= 10;
  }
  return Res;
}
long long Rec(long long x) {
  if (x == 0) return 0;
  if (x < 10) return x;
  long long c = LOG(x);
  long long ld = x / p[c - 1];
  long long rd = x % 10;
  if (x < 100) return (rd >= ld ? ld : ld - 1) + 9;
  long long Res = 0;
  if (ld <= rd) {
    Res += (x % p[c - 1]) / 10 + 1;
    x = p9[c - 1];
    x += p[c - 1] * (ld - 1);
    Res += Rec(x);
  } else {
    x -= (rd + 1);
    Res += Rec(x);
  }
  return Res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  p[0] = 1ll;
  for (int i = 1; i <= 18; i++) p[i] = p[i - 1] * 10;
  for (int i = 1; i <= 18; i++) p9[i] = p[i] - 1;
  cin >> l >> r;
  cout << Rec(r) - Rec(l - 1) << '\n';
  return 0;
}
