#include <bits/stdc++.h>
using namespace std;
long long cnt(long long x) {
  if (x < 10) return x;
  if (x == 10) return 9;
  long long res, i;
  for (i = 1, res = 0; i * 10 < x; i *= 10) res += max(1LL, i / 10) * 9;
  res += (x / i - 1) * (i / 10);
  long long mid = (x % i) / 10;
  if (x / i <= x % 10) mid++;
  return res + mid;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << cnt(r) - cnt(--l) << endl;
  return 0;
}
