#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp, nueves;
void gen() {
  long long i;
  long long j = 1;
  mp[1] = 1;
  mp[11] = 10;
  mp[101] = 19;
  nueves[0] = 0;
  nueves[1] = 9;
  for (i = 1000; i < 1000000000000000002LL; i = i * 10, ++j) {
    mp[i + 1] = i / 10 + 9;
    nueves[j + 1] = nueves[j] * 10 + 9;
  }
}
int getDigit(long long n) {
  int cnt = 0;
  while (n > 0) {
    n /= 10;
    cnt++;
  }
  return cnt;
}
string substring(string s, int a, int b) {
  string aux = "";
  for (int i = a; i < b; ++i) aux += s[i];
  return aux;
}
long long toInt(string str) {
  long long n;
  istringstream buffer(str);
  buffer >> n;
  return n;
}
long long f(long long n) {
  if (n < 10) return n;
  if (n == 10) return 9;
  int cnt = getDigit(n);
  long long ant = 1, end = 1;
  for (map<long long, long long>::iterator it = mp.begin(); it != mp.end();
       ++it) {
    if (it->first > n) {
      end = it->first;
      break;
    }
    ant = it->first;
  }
  string s;
  stringstream ss;
  ss << n;
  ss >> s;
  int digit = s[0] - '0', last = s[s.length() - 1] - '0';
  long long ceros = getDigit(ant);
  if (ceros >= 2)
    ceros -= 2;
  else
    ceros = 0;
  long long ans = mp[ant] + (nueves[ceros] + 1) * (digit - 1) - 1;
  if (getDigit(ant) == cnt) {
    if (digit >= last) {
      if (s.length() > 2) {
        ans += toInt(substring(s, 1, s.length() - 1));
      }
      if (digit == last) ans++;
    } else if (digit < last) {
      if (s.length() > 2) {
        ans += toInt(substring(s, 1, s.length() - 1));
      }
      ans++;
    }
  } else if (getDigit(ant) < cnt) {
    ans += mp[end] - mp[ant];
  }
  return ans;
}
int main() {
  gen();
  long long a, b;
  scanf("%I64d %I64d", &a, &b);
  printf("%I64d\n", f(b) - f(a - 1));
  return 0;
}
