#include <bits/stdc++.h>
using namespace std;
long long int GetCount(long long int N) {
  if (N == 0LL) return 0;
  int len = 0;
  long long int temp = N;
  int dig = 0;
  while (temp) {
    len++;
    dig = (int)(temp % 10LL);
    temp /= 10LL;
  }
  int i;
  long long int res = 0LL;
  if (len > 1) res += 9LL;
  if (len > 2) res += 9LL;
  long long int coef = 10LL;
  for (i = 3; i < len; i++) {
    res += (9LL * coef);
    coef = coef * 10LL;
  }
  if (len == 1) {
    res += (long long int)(dig - 1);
    res++;
  } else if (len == 2) {
    res += (long long int)(dig - 1);
    if ((int)(N % 10LL) >= dig) res++;
  } else {
    res += (long long int)(dig - 1) * coef;
    temp = N;
    temp -= (long long int)(dig)*coef * 10LL;
    temp /= 10LL;
    res += temp;
    if ((int)(N % 10LL) >= dig) res++;
  }
  return res;
}
int main() {
  long long int L, R;
  scanf("%I64i %I64i", &L, &R);
  long long int res = GetCount(R) - GetCount(L - 1LL);
  printf("%I64i\n", res);
  return 0;
}
