#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long N = 3e4 + 1;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
long long L, R, d[20];
int f(long long x) {
  int res = x;
  while (x) res = x, x /= 10;
  return res;
}
long long get(long long x) {
  while (f(x) != x % 10) x--;
  if (x < 10) return x;
  long long res = 0;
  long long i = 1, j = 10;
  for (; j <= x; j *= 10, i++) res += d[i];
  j /= 10;
  return res + (x - j) / 10 + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  d[1] = d[2] = 9;
  for (int i = 3; i <= 18; i++) d[i] = d[i - 1] * 10;
  cin >> L >> R;
  cout << get(R) - get(L - 1);
}
