#include <bits/stdc++.h>
using namespace std;
long long l, r, total;
long long poww(int a, int b) {
  long long res = 1;
  for (int i = 0; i < b; i++) res *= 1ll * a;
  return res;
}
bool provera(long long a) {
  int c[20], cnt = 0;
  while (a > 0) {
    int ss = a % 10;
    c[cnt++] = ss;
    a /= 10;
  }
  if (c[cnt - 1] == c[0])
    return true;
  else
    return false;
}
int cifre(long long a) {
  int res = 0;
  while (a > 0) {
    a /= 10;
    res++;
  }
  return res;
}
long long razlika_prva(long long a) {
  long long res = 0;
  int c[20], cnt = 0;
  while (a > 0) {
    int ss = a % 10;
    c[cnt++] = ss;
    a /= 10;
  }
  if (cnt == 1) {
    res += 1ll * (9 - c[0]);
  }
  reverse(c, c + cnt);
  for (int i = 0; i < cnt - 1; i++) {
    int pot = 9 - c[i];
    res += 1ll * pot * poww(10, cnt - 2 - i);
  }
  if (c[cnt - 1] <= c[0]) res++;
  return res;
}
long long razlika_druga(long long a) {
  long long res = 0;
  int c[20], cnt = 0;
  while (a > 0) {
    int ss = a % 10;
    c[cnt++] = ss;
    a /= 10;
  }
  if (cnt == 1) {
    res = c[0];
    return res;
  }
  reverse(c, c + cnt);
  for (int i = 0; i < cnt - 1; i++) {
    if (i >= 1)
      res += 1ll * (c[i]) * poww(10, cnt - 2 - i);
    else if (i == 0)
      res += 1ll * (c[i] - 1) * poww(10, cnt - 2);
  }
  if (c[cnt - 1] >= c[0]) res++;
  return res;
}
int main() {
  cin >> l >> r;
  int d = cifre(l) + 1, u = cifre(r) - 1;
  for (int i = d; i <= u; i++) {
    total += 9 * poww(10, i - 2);
  }
  total += razlika_prva(l);
  total += razlika_druga(r);
  if (d - 1 == u + 1) {
    total = 0;
    total += razlika_druga(r);
    total -= razlika_druga(l);
    if (l == r && provera(l))
      total = 1;
    else if (provera(l))
      total++;
  }
  cout << total;
  return 0;
}
