#include <bits/stdc++.h>
using namespace std;
long long countdigits(long long n) {
  long long res = 0;
  while (n != 0) {
    res++;
    n /= 10;
  }
  return res;
}
long long convert(string s) {
  reverse(s.begin(), s.end());
  long long res = 0;
  for (long long i = 0; i < (long long)s.length(); i++)
    res += (s[i] - '0') * (long long)powl(10, i);
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long l, r;
  cin >> l >> r;
  string L = to_string(l);
  string R = to_string(r);
  long long res = 0;
  long long cntl = countdigits(l);
  long long cntr = countdigits(r);
  for (long long i = cntl + 1; i < cntr; i++) {
    res += 9 * (long long)powl(10, i - 2);
  }
  long long larger = 0;
  long long smaller = 0;
  if (l <= 9) {
    larger += 10 - l;
  } else if (l <= 99) {
    for (long long i = l; i <= 99; i++) {
      if (i / 10 == i % 10) larger++;
    }
  } else {
    long long firstdigit = L[0] - '0';
    larger += (9 - firstdigit) * (long long)powl(10, (long long)L.length() - 2);
    string middle;
    for (long long i = 1; i < (long long)L.length() - 1; i++) middle += L[i];
    long long Middle = convert(middle);
    Middle = (long long)powl(10, (long long)L.length() - 2) - Middle;
    larger += Middle;
    if (L[0] < L.back()) larger--;
  }
  res += larger;
  if (r <= 9) {
    smaller += r;
  } else if (r <= 99) {
    for (long long i = 11; i <= r; i++) {
      if (i % 10 == i / 10) smaller++;
    }
  } else {
    long long firstdigit = R[0] - '0';
    smaller +=
        (firstdigit - 1) * (long long)powl(10, (long long)R.length() - 2);
    string middle;
    for (long long i = 1; i < (long long)R.length() - 1; i++) middle += R[i];
    long long Middle = convert(middle);
    smaller += Middle + 1;
    if (R[0] > R.back()) smaller--;
  }
  res += smaller;
  if (cntl != cntr) {
    cout << res << '\n';
    return 0;
  }
  l = r;
  L = R;
  if (l <= 9) {
    larger -= 10 - l;
  } else if (l <= 99) {
    for (long long i = l; i <= 99; i++) {
      if (i / 10 == i % 10) larger--;
    }
  } else {
    long long firstdigit = L[0] - '0';
    larger -= (9 - firstdigit) * (long long)powl(10, (long long)L.length() - 2);
    string middle;
    for (long long i = 1; i < (long long)L.length() - 1; i++) middle += L[i];
    long long Middle = convert(middle);
    Middle = (long long)powl(10, (long long)L.length() - 2) - Middle;
    larger -= Middle;
    if (L[0] < L.back()) larger++;
  }
  if (L[0] == L.back()) larger++;
  cout << larger << '\n';
  return 0;
}
