#include <bits/stdc++.h>
using namespace std;
long long a[20], b[20];
int digits(long long n) {
  int i;
  for (i = 1; i < 19; i++) {
    if (i < 18)
      if (n >= a[i - 1] && n < a[i])
        break;
      else
        continue;
    else if (n == a[i])
      i++;
    break;
  }
  return i;
}
long long cal(long long n) {
  int i = digits(n);
  long long cnt = 0;
  for (int j = 1; j < digits(n); j++) cnt += b[j];
  int h = n / a[i - 1], l = n % 10;
  long long tmp = (n % a[i - 1]) / 10;
  int t = (h > l ? h - 1 : h);
  if (i - 2 > 0) {
    if (t > 0)
      cnt = cnt + (h > l ? t : t - 1) * (a[i - 2]) + tmp + (h > l ? 0 : 1);
    else
      cnt = cnt + tmp;
  } else if (i == 2)
    cnt = b[1] + t;
  else
    cnt += n;
  return cnt;
}
int main() {
  a[0] = 1;
  long long x = 1;
  for (int i = 1; i < 19; i++) {
    a[i] = 10 * x, x *= 10;
  }
  b[0] = 1;
  b[2] = b[1] = 9;
  for (int i = 3; i < 20; i++) {
    b[i] = a[i - 2] * 9;
  }
  long long cnt = 0, n1, n2;
  cin >> n1 >> n2;
  cnt = cal(n2) - cal(n1);
  if (n1 / a[digits(n1) - 1] == n1 % 10) cnt++;
  cout << cnt << endl;
  return 0;
}
