#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
const int POWERS_MAX = 19;
long long p10[POWERS_MAX];
void compute_powers() {
  p10[0] = 1;
  for (int(i) = (1); (i) <= (POWERS_MAX - 1); ++i) {
    p10[i] = 10 * p10[i - 1];
  }
}
int len(long long n) {
  if (n == 0) return 1;
  int res = 0;
  while (n > 0) {
    res++;
    n = n / 10;
  }
  return res;
}
int first_digit(long long n) {
  while (n >= 10) n = n / 10;
  return n;
}
long long count_equal_len(long long n) {
  int f_digit = first_digit(n);
  int l_digit = n % 10;
  int l = len(n);
  long long res = 0;
  res += (f_digit - 1) * p10[l - 2];
  n = n / 10;
  l--;
  res += (n % p10[l - 1]);
  if (f_digit <= l_digit) res++;
  return res;
}
long long count(long long u) {
  int l = len(u);
  long long res = 0;
  if (l == 1) {
    return u;
  } else {
    res = 9;
    for (int(i) = (0); (i) <= (l - 3); ++i) {
      res += 9 * p10[i];
    }
    res += count_equal_len(u);
  }
  return res;
}
int main() {
  compute_powers();
  long long l, u;
  cin >> l >> u;
  cout << count(u) - count(l - 1) << endl;
  return 0;
}
