#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const long double pi = 3.141592653589793238462643383279502884;
long long log10(long long x) {
  long long ans = 0;
  while (x /= 10) ans++;
  return ans;
}
long long lastdigit(long long x) {
  while (x >= 10) x /= 10;
  return x;
}
long long pow(long long x, long long n) {
  if (n == 0) return 1LL;
  long long aux = pow(x, n / 2);
  return aux * aux * (n % 2 == 1 ? x : 1LL);
}
vector<long long> total{9, 18};
long long numbers(long long k) {
  if (lastdigit(k) > k % 10) k -= k % 10 + 1;
  if (k < 10) return k;
  long long ans = 1;
  long long n = log10(k);
  long long copyk = k;
  copyk /= 10;
  for (long long i = 0; i < n - 1; ++i) {
    ans += copyk % 10 * pow(10LL, i);
    copyk /= 10;
  }
  ans += (lastdigit(k) - 1) * pow(10LL, n - 1);
  ans += total[n - 1];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 2LL; i <= 17LL; ++i) {
    total.push_back(9LL * pow(10LL, i - 1));
    total[i] += total[i - 1];
  }
  long long l, r;
  cin >> l >> r;
  cout << numbers(r) - numbers(l - 1);
  return 0;
}
