#include <bits/stdc++.h>
const long double PI = 3.141592653589793238L;
using namespace std;
long long f(int x) {
  long long X = 1;
  for (int i = 1; i <= x; ++i) X *= 10;
  return X;
}
long long f2(long long x) {
  while (x / 10) x /= 10;
  return x;
}
long long F(long long x) {
  if (x < 10) return x;
  string s = to_string(x);
  long long ans = 9;
  for (int j = 2; j < s.size(); ++j) ans += 9 * f(j - 2);
  bool done = 1;
  for (int i = 1; i < s.size(); ++i)
    if (s[i] != '0') done = 0;
  if (done && s[0] == '1') return ans;
  while (x % 10 != f2(x)) --x;
  ans += (f2(x) - 1) * f((int)s.size() - 2);
  long long z = ((long long)x % f((int)s.size() - 1)) / 10;
  return ans + z + 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long l, r;
  cin >> l >> r;
  cout << F(r) - F(l - 1);
  return 0;
}
