#include <bits/stdc++.h>
using namespace std;
long long l, r;
int first_digit(long long x) {
  int res;
  while (x > 0) {
    res = x % 10;
    x /= 10;
  }
  return res;
}
int digits_number(long long x) {
  int cou = 0;
  while (x > 0) {
    ++cou;
    x /= 10;
  }
  return cou;
}
long long calc(long long x) {
  int ile = 0;
  if (x <= 9) return x;
  if (x <= 99) {
    for (int i = 1; i <= x; ++i)
      if (i / 10 == i % 10) ++ile;
    return ile + 9;
  }
  int cou = 0;
  long long num, add = 90;
  cou = digits_number(x);
  --cou;
  if (cou == 1) num = 9;
  if (cou >= 2) num = 18;
  for (int i = 3; i <= cou; ++i) {
    num += add;
    add *= 10;
  }
  add /= 9;
  while (first_digit(x) != x % 10) --x;
  if (digits_number(x) == cou) return num;
  num += add * (first_digit(x) - 1);
  add *= 10;
  long long pom = x - add * first_digit(x);
  pom /= 10;
  num += (pom + 1);
  return num;
}
int main() {
  cin >> l >> r;
  cout << calc(r) - calc(l - 1) << endl;
  return 0;
}
