#include <bits/stdc++.h>
using namespace std;
long long l, r;
long long x10(int x) {
  long long ans = 1;
  if (x == -1) return ans;
  while (x--) ans *= 10;
  return ans;
}
long long f(long long x) {
  long long k = 1, n = 0, ans = 0;
  if (x == 0) return 0;
  while (k < x) {
    k *= 10;
    n++;
  }
  if (k > x)
    k /= 10;
  else
    n++;
  for (int i = -1; i < n - 2; i++) ans += x10(i) * 9;
  for (int i = 1; i < x / k; i++) ans += x10(n - 2);
  for (int i = 1; i < n - 1; i++) ans += (x % x10(i + 1)) / x10(i) * x10(i - 1);
  if (x / k <= x % 10) ans++;
  return ans;
}
int main() {
  cin >> l >> r;
  cout << f(r) - f(l - 1) << endl;
  return 0;
}
