#include <bits/stdc++.h>
using namespace std;
long long Pow10(int a) {
  long long res = 1;
  for (int i = 0; i < (a); ++i) {
    res *= 10;
  }
  return res;
}
long long func(const long long a) {
  if (a < 10) return a;
  long long res(0);
  stringstream ss;
  ss << a;
  string s;
  ss >> s;
  int last_digit = a % 10;
  long long temp = Pow10(s.size() - 1);
  int first_digit = a / temp;
  long long mid = a / 10 - first_digit * temp / 10;
  if (last_digit >= first_digit) ++res;
  for (int i = 1; i < s.size(); ++i) {
    if (i == 1)
      res += 9;
    else
      res += 9 * Pow10(i - 2);
  }
  res += (first_digit - 1) * Pow10(s.size() - 2);
  res += mid;
  return res;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << func(r) - func(l - 1) << endl;
  return 0;
}
