#include <bits/stdc++.h>
using namespace std;
long long check(long long n) {
  long long d = n % 10;
  while (n > 9) n /= 10;
  return d == n;
}
long long pow(long long a, long long b) {
  if (b == 0) return 1;
  long long t = pow(a, b / 2);
  if (b % 2)
    return (a * t * t);
  else
    return (t * t);
}
long long f(long long n) {
  while (!check(n)) n--;
  long long m = n, c = 0;
  while (m != 0) {
    m /= 10;
    c++;
  }
  long long ans = 0;
  for (long long i = 1; i < c; i++) {
    if (i == 1)
      ans += 9;
    else
      ans += 9 * pow(10, i - 2);
  }
  if (c < 2) return n;
  ans += (n % 10 - 1) * pow(10, c - 2);
  long long k = 0;
  while (n > 9) {
    k = 10 * k + n % 10;
    n /= 10;
  }
  m = k;
  k = 0;
  while (m > 9) {
    k = 10 * k + m % 10;
    m /= 10;
  }
  ans += k + 1;
  return ans;
}
void solve() {
  long long l, r;
  cin >> l >> r;
  cout << (f(r) - f(l - 1));
}
signed main() {
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) solve();
  return 0;
}
