#include <bits/stdc++.h>
using namespace std;
long long cat(long long a) {
  long long s = a;
  int num[30], cnt = 0;
  while (a) {
    num[cnt++] = a % 10;
    a /= 10;
  }
  if (num[0] >= num[cnt - 1])
    return s - num[0] + num[cnt - 1];
  else
    return s - (10 + num[0]) + num[cnt - 1];
}
long long num(long long a) {
  if (a == 0) return 0;
  if (a <= 9) return a;
  if (a <= 100) return a / 11 + 9;
  return (cat(a) - 101) / 10 + 19;
}
int main() {
  long long m, n;
  cin >> n >> m;
  cout << num(m) - num(n - 1);
  return 0;
}
