#include <bits/stdc++.h>
using namespace std;
long long l, r;
int stop;
long long getsum(long long d, int n) {
  long long a1 = d;
  long long a2 = d;
  --n;
  for (int i = 0; i < n; ++i) a1 *= 10, a2 *= 10, a2 += 9;
  if (n >= 1) {
    a1 += d;
    a1 = max(a1, l);
    a2 -= 9;
    a2 += d;
  }
  if (a2 >= r) a2 = r, stop = 1;
  long long qtd = (a2 - a1) / 10 + 1;
  return qtd;
}
int prim(long long a) {
  while (a >= 10) a /= 10;
  return a;
}
int last(long long a) { return a % 10; }
int tam(long long l) {
  int ans = 0;
  while (l) {
    ++ans;
    l /= 10;
  }
  return ans;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> l >> r;
  int d = last(l);
  int f = prim(l);
  if (f != d) {
    if (f > d) {
      l /= 10;
      l *= 10;
      l += f;
    } else {
      l /= 10;
      ++l;
      l *= 10;
      l += prim(l);
    }
  }
  d = last(r);
  f = prim(r);
  if (f != d) {
    if (f < d) {
      r /= 10;
      r *= 10;
      r += f;
    } else {
      if (r == 10)
        r = 9;
      else {
        r /= 10;
        --r;
        r *= 10;
        r += prim(r);
      }
    }
  }
  if (l > r) {
    cout << "0\n";
    return 0;
  }
  int start = prim(l);
  stop = 0;
  int t = tam(l);
  long long ans = 0;
  while (!stop) {
    ans += getsum(start, t);
    ++start;
    if (start == 10) start = 1, ++t;
  }
  cout << ans << '\n';
}
