#include <bits/stdc++.h>
const long long int mod = 1e9 + 7;
using namespace std;
long long int p, q, r, s;
long long int len(long long int x) {
  long long int count = 0;
  while (x > 0) {
    x = x / 10;
    count++;
  }
  return count;
}
long long int fx(long long int x) {
  long long int count = 9;
  if (x <= 9) return x;
  p = len(x);
  q = x % 10;
  x /= 10;
  r = x / pow(10, p - 2);
  s = pow(10, p - 2);
  x = x % s;
  if (p == 2) {
    count += r;
    if (q < r) count--;
    return count;
  }
  for (int i = (1); i <= (p - 2); i++) count += 9 * pow(10, i - 1);
  count += (r - 1) * pow(10, p - 2);
  count += x + 1;
  if (q < r) count--;
  return count;
}
int main() {
  long long int y, z;
  cin >> y >> z;
  long long int temp = fx(z) - fx(y - 1);
  cout << temp << endl;
}
