#include <bits/stdc++.h>
const double EPS = 1e-9;
const int INT_INF = 1 << 31 - 1;
const long long I64_INF = 1ll << 63 - 1ll;
const double PI = acos(-1.0);
using namespace std;
long long solve(int len) {
  if (len == 1 || len == 2) return 9LL;
  long long pow = 1LL;
  for (int i = 0; i < len - 2; i++) pow *= 10LL;
  return 9LL * pow;
}
long long go(long long r) {
  if (r <= 0) return 0;
  int len = 0;
  long long R = r;
  long long c[20];
  while (R) c[len] = R % 10LL, len++, R /= 10LL;
  long long res = 0;
  for (int i = 1; i < len; i++) res += solve(i);
  for (int i = 0; i < (int)len / 2; i++) swap(c[i], c[len - i - 1]);
  long long pow = 1LL;
  for (int i = 0; i < len - 2; i++) pow *= 10LL;
  res += (c[0] - 1LL) * pow;
  long long mid = 0;
  for (int i = 1; i <= len - 2; i++) mid = mid * 10LL + 1LL * c[i];
  if (c[0] <= c[len - 1])
    res += mid + 1LL;
  else
    res += mid;
  return res;
};
bool ok(int a) {
  int last = a % 10;
  int first;
  while (a) first = a % 10, a /= 10;
  return first == last;
}
long long l, r;
int main() {
  cin >> l >> r;
  cout << go(r) - go(l - 1) << "\n";
  return 0;
}
