#include <bits/stdc++.h>
using namespace std;
long long int dig(long long int n) {
  long long int r = 0;
  while (n) {
    ++r;
    n = n / 10;
  }
  return (r - 1);
}
long long int func(long long int n) {
  if (n <= 9) return (n + 1);
  long long int lt = dig(n);
  lt = pow(10, lt);
  long long int ret = lt - 1;
  long long int mul = ret / 10;
  long long int mid = (n % lt) / 10;
  lt = n / lt;
  long long int rt = n % 10;
  if (rt >= lt) {
    return (lt * (mul + 1) + func(ret));
  } else {
    return (lt * (mul + 1) + func(ret));
  }
}
long long int fun(long long int n) {
  if (n <= 9) return (n + 1);
  long long int lt = dig(n);
  lt = pow(10, lt);
  long long int ret = lt - 1;
  long long int mul = ret / 10;
  long long int mid = (n % lt) / 10;
  lt = n / lt;
  long long int rt = n % 10;
  if (rt >= lt) {
    return ((mid + 1) + (lt - 1) * (mul + 1) + func(ret));
  } else {
    return (mid + (lt - 1) * (mul + 1) + func(ret));
  }
}
int main() {
  long long int l, r;
  cin >> l >> r;
  cout << fun(r) - fun(l - 1);
  return 0;
}
