#include <bits/stdc++.h>
using namespace std;
long long sum;
int digitr, digitl;
long long l, r;
long long maker(int digit) {
  string s = "";
  s += '9';
  if (digit > 1) {
    for (int i = 0; i < digit - 1; i++) s += '9';
  }
  stringstream ss;
  ss << s;
  long long k;
  ss >> k;
  return k;
}
long long makel(int digit) {
  string s = "";
  s += '1';
  if (digit > 1) {
    for (int i = 0; i < digit - 2; i++) s += '0';
    s += '1';
  }
  stringstream ss;
  ss << s;
  long long k;
  ss >> k;
  return k;
}
bool check(long long i) {
  stringstream ss;
  ss << i;
  string s = ss.str();
  return s[0] == s[s.length() - 1];
}
long long STL(string s) {
  stringstream ss;
  ss << s;
  long long k;
  ss >> k;
  return k;
}
long long LTL(long long i) {
  long long k = i / 10;
  k++;
  return k;
}
int solve() {
  while (!check(l)) l++;
  while (!check(r)) r--;
  if (l > r)
    sum += 0;
  else if (l == r)
    sum += 1;
  else if (digitl == 1)
    sum += r - l + 1;
  else
    sum += LTL(r - l);
  return sum;
}
int getdigit(long long i) {
  int c = 0;
  while (i) {
    i /= 10;
    c++;
  }
  return c;
}
int main() {
  cin >> l >> r;
  digitl = getdigit(l), digitr = getdigit(r);
  if (digitl == digitr) {
    solve();
    cout << sum << endl;
    return 0;
  }
  long long b = r;
  while (getdigit(l) <= digitr) {
    r = min(maker(digitl), b);
    if (r > b) break;
    solve();
    if (digitl == 18) break;
    digitl++;
    l = makel(digitl);
  }
  cout << sum << endl;
}
