#include <bits/stdc++.h>
using namespace std;
long long l, r;
long long p10(int q) {
  long long res = 1;
  while (q > 0) {
    q--;
    res *= 10;
  }
  return res;
}
int len(long long x) {
  int l = 0;
  while (x) {
    x /= 10;
    l++;
  }
  return l;
}
bool comp(long long x) {
  int l = len(x);
  if (l == 1) return true;
  long long p = p10(l - 1), t1 = x % 10, t2 = x / p;
  return (t1 == t2);
}
long long top(long long* x) {
  while (!comp(*x)) (*x)++;
  int l = len(*x);
  long long ans;
  if (l == 1) {
    ans = 10 - *x;
    *x = 10;
  } else {
    long long x1 = (*x % p10(l - 1)) / 10, x2 = p10(l - 2) - 1, t = *x % 10;
    ans = x2 - x1 + 1;
    *x = t * p10(l - 1) + x2 * 10 + t + 1;
  }
  return ans;
}
int main() {
  cin >> l >> r;
  long long ans = 0;
  while (l < r) ans += top(&l);
  if (comp(r)) ans++;
  if (r < l) ans -= top(&r);
  cout << ans;
}
