#include <bits/stdc++.h>
using namespace std;
unsigned long long int pow10(int n) {
  unsigned long long int p = 1;
  for (int i = 0; i < n; i++) p *= 10;
  return p;
}
unsigned long long int make9(int n) {
  unsigned long long int r = 9;
  for (int i = 1; i < n; i++) r = r * 10 + 9;
  return r;
}
int get_size(unsigned long long int n) {
  int r = 0;
  while (n) {
    n /= 10;
    r++;
  }
  return r;
}
int find_max(unsigned long long int &n) {
  int k = get_size(n);
  int t1 = n / pow10(k - 1);
  int t2 = n % 10;
  while (t1 != t2) {
    n--;
    k = get_size(n);
    t1 = n / pow10(k - 1);
    t2 = n % 10;
  }
  return t1;
}
unsigned long long int count_numbers(unsigned long long int n) {
  int k = get_size(n);
  int t1;
  unsigned long long int r = 0;
  for (int i = 1; i <= k; i++) {
    if (i == k) {
      t1 = find_max(n);
      if (get_size(n) == k) {
        r += t1 * pow10(max(k - 2, 0));
        if (k > 2) r -= make9(k - 2) - (n % pow10(k - 1)) / 10LL;
      }
    } else
      r += 9 * pow10(max(i - 2, 0));
  }
  return r;
}
int main() {
  long long int a;
  long long int b;
  while (cin >> a >> b) cout << count_numbers(b) - count_numbers(a - 1) << endl;
  return 0;
}
