#include <bits/stdc++.h>
using namespace std;
long long solution(long long x, char a[], long long y) {
  long long s = x;
  long long num = 0;
  long long i, j, k;
  k = 1;
  for (i = 1; i < x; i++) {
    if (i <= 2)
      num += 9;
    else {
      k *= 10;
      num += (k * 9);
    }
  }
  for (i = 1; i < a[0] - '0'; i++) {
    if (x <= 2)
      num += 1;
    else
      num += (k * 10);
  }
  if (x <= 2) {
    if (a[x - 1] >= a[0]) num += 1;
  } else {
    j = 0;
    for (i = 1; i < x - 1; i++) {
      j = j * 10 + a[i] - '0';
    }
    if (a[x - 1] >= a[0]) j++;
    num += j;
  }
  return num;
}
void mitoa(long long l, char a[100], long long n) {
  char c[100];
  int k = 0;
  while (l) {
    c[k++] = l % n;
    l /= n;
  }
  for (int i = 0; i < k; i++) {
    a[i] = c[k - i - 1] + '0';
  }
  a[k] = 0;
}
int main() {
  long long l, r, suma, sumb;
  char a[100], b[100];
  while (~scanf("%I64d%I64d", &l, &r)) {
    mitoa(l, a, 10);
    mitoa(r, b, 10);
    sumb = solution(strlen(b), b, r);
    suma = solution(strlen(a), a, l);
    if (a[0] == a[strlen(a) - 1]) sumb++;
    printf("%I64d\n", sumb - suma);
  }
  return 0;
}
