#include <bits/stdc++.h>
using namespace std;
long long cnt[19], val[19];
void init() {
  cnt[1] = 9, cnt[2] = 9, cnt[3] = 90;
  val[1] = 1, val[2] = 10, val[3] = 100;
  long long t = 100;
  for (int i = 4; i <= 19; i++)
    cnt[i] = t * 9, t *= 10, val[i] = val[i - 1] * 10;
}
long long cal(long long a) {
  long long bit = 0, tmp, p = a;
  while (p) {
    tmp = p;
    p /= 10;
    bit++;
  }
  long long ans = 0;
  for (int i = 1; i <= bit - 1; i++) {
    ans += cnt[i];
  }
  if (bit > 2)
    ans += cnt[bit] / 9 * (tmp - 1);
  else
    ans += tmp - 1;
  long long maxn;
  long long minn = tmp;
  for (int i = 1; i < bit; i++) {
    minn *= 10;
  }
  minn += tmp;
  maxn = a;
  int mowei = a % 10;
  if (mowei >= tmp)
    maxn = maxn - mowei + tmp;
  else if (maxn - 10 >= tmp * val[bit])
    maxn = maxn - 10 - mowei + tmp;
  else
    return ans;
  maxn = (maxn - tmp * val[bit]) / 10;
  return maxn + 1 + ans;
}
int main() {
  long long l, r;
  while (~scanf("%I64d%I64d", &l, &r)) {
    init();
    long long a = cal(l), b = cal(r);
    if (l < 10) a = l;
    if (r < 10) b = r;
    long long ans = b - a;
    long long tmp1 = l % 10, tmp2;
    while (l) {
      tmp2 = l;
      l /= 10;
    }
    if (tmp1 == tmp2) ans++;
    printf("%I64d\n", ans);
  }
  return 0;
}
