#include <bits/stdc++.h>
char a[100];
char b[100];
long long dec[19];
int main() {
  int n, m;
  scanf("%s %s", a, b);
  n = strlen(a);
  m = strlen(b);
  for (int i = 0; i < n; i++) a[i] -= '0';
  for (int i = 0; i < m; i++) b[i] -= '0';
  dec[0] = 1;
  for (int i = 1; i < 19; i++) dec[i] = dec[i - 1] * 10;
  long long count = 0;
  long long up, low;
  for (int i = 2; i < n; i++) {
    count += 9 * dec[i - 2];
  }
  if (n - 2 >= 0) count += (a[0] - 1) * dec[n - 2];
  if (n > 1)
    count += 9;
  else
    count += a[0];
  for (int i = 1; i < n - 1; i++) {
    count += a[i] * dec[n - i - 2];
  }
  if (n > 1) count++;
  if (a[n - 1] < a[0]) count--;
  low = count;
  count = 0;
  for (int i = 2; i < m; i++) {
    count += 9 * dec[i - 2];
  }
  if (m - 2 >= 0) count += (b[0] - 1) * dec[m - 2];
  if (m > 1)
    count += 9;
  else
    count += b[0];
  for (int i = 1; i < m - 1; i++) {
    count += b[i] * dec[m - i - 2];
  }
  if (m > 1) count++;
  if (b[m - 1] < b[0]) count--;
  up = count;
  long long ans = up - low;
  if (a[0] == a[n - 1]) ans++;
  printf("%I64d\n", ans);
}
