#include <bits/stdc++.h>
using namespace std;
long long pw[20];
long long calc(int w, long long m) {
  if (w == 1) return m;
  int p = (int)(m / pw[w - 1]);
  long long ans = 0;
  ans += (p - 1) * pw[w - 2];
  m -= pw[w - 1] * 1LL * p;
  if (m % 10 >= p) {
    m /= 10;
    ans += m + 1;
  } else {
    m /= 10;
    ans += m;
  }
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  int wl = 0, wr = 0;
  long long t = l;
  while (t > 0) {
    wl++;
    t /= 10;
  }
  t = r;
  while (t > 0) {
    wr++;
    t /= 10;
  }
  int i;
  pw[0] = 1;
  for (i = 1; i <= 19; i++) pw[i] = pw[i - 1] * 10LL;
  long long ans = 0;
  for (i = wl + 1; i <= wr - 1; i++) ans += calc(i, pw[i] - 1);
  if (wl == wr)
    ans += calc(wr, r) - calc(wl, l);
  else
    ans += calc(wr, r) + calc(wl, pw[wl] - 1) - calc(wl, l);
  if (l / pw[wl - 1] == l % 10) ans++;
  cout << ans << endl;
  return 0;
}
