#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535897932;
const long long MAXN = 1000000;
const long long base = 1000000000;
long long r, l;
long long f(long long x) {
  if (x <= 9) return x;
  long long loga = -1;
  long long x1 = x;
  while (x1) {
    loga++;
    x1 /= 10;
  }
  long long ans = 0;
  if (loga == 1) ans += 9;
  if (loga > 1) {
    ans = 1;
    for (long long i = 1; i < loga; i++) ans *= 10;
    ans += 8;
  }
  x1 = x;
  long long lts = x1 % 10;
  x1 = x;
  while (x1 > 9) x1 /= 10;
  long long fts = x1;
  x1 = x;
  long long deg = 1;
  while (x1) {
    deg *= 10;
    x1 /= 10;
  }
  deg /= 10;
  x1 = x;
  x1 /= 10;
  x1 -= fts * (deg / 10);
  ans += x1;
  ans += (fts - 1) * (deg / 10);
  if (lts >= fts) ans++;
  return ans;
}
int main() {
  cin >> l >> r;
  cout << f(r) - f(l - 1) << endl;
  return 0;
}
