#include <bits/stdc++.h>
using namespace std;
long long a, b, dp[22], p[22], dig[11];
int len(long long x) {
  int res = 0;
  while (x) {
    x /= 10;
    res++;
  }
  return res;
}
long long f(long long x) {
  if (x < 10) return x;
  if (x < 100) {
    if (x / 10 <= x % 10)
      return x / 10 + dp[1];
    else
      return x / 10 - 1 + dp[1];
  }
  long long curx = x, res = 0;
  int fd = 0, cnt = 0, ld, add;
  while (curx) {
    if (curx < 10) fd = curx;
    curx /= 10;
    cnt++;
  }
  vector<int> r;
  r.reserve(20);
  while (x % 10 != fd) x--;
  if (len(x) == cnt) {
    add = 1;
    curx = x;
    while (curx) {
      r.push_back(curx % 10);
      curx /= 10;
    }
    long long k = 1, q = 1;
    for (int i = 1; i < r.size() - 1; i++, q *= 10) k = k + q * r[i];
    res = k;
    if (r.size() >= 3) res += ((fd - 1) * p[r.size() - 2]);
  }
  for (int i = cnt - 1; i > 0; i--) res += dp[i];
  return res;
}
int main() {
  scanf("%I64d", &a);
  scanf("%I64d", &b);
  dp[1] = dp[2] = 9LL;
  p[0] = 1LL;
  dig[0] = 1;
  for (int i = 1; i <= 9; i++) dig[i] = i + 1;
  for (int i = 1; i <= 17; i++) p[i] = p[i - 1] * 1LL * 10;
  for (int i = 3; i <= 19; i++) dp[i] = 9 * 1LL * p[i - 2];
  printf("%I64d", f(b) - f(a - 1));
}
