#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAX = 1e6;
long long int ten[20];
int len(long long int a) {
  int sz = 0;
  while (a > 0) a /= 10, sz++;
  return sz;
}
bool F_L(long long int a) {
  long long int x, y;
  if (a / ten[len(a)] == a % 10) return 1;
  return 0;
}
long long int lower_part2(long long int l) {
  long long int x = 0;
  for (int i = 0; i < len(l); i++) x *= 10, x += 9;
  x -= l;
  if (len(l) > 1) x /= 10;
  return x + 1;
}
long long int upper_part2(long long int r) {
  long long int x = 1;
  for (int i = 0; i < len(r) - 1; i++) x *= 10;
  x += 1;
  r -= x;
  if (len(r) > 1) r /= 10;
  return r + 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ten[1] = 1;
  for (int i = 2; i <= 19; i++) {
    ten[i] = ten[i - 1] * 10;
  }
  long long int l, r, base, sum = 0;
  cin >> l >> r;
  if (len(l) == len(r)) {
    while (!(F_L(l))) l++;
    while (!(F_L(r))) r--;
    if (l > r) {
      cout << "0" << endl;
      return 0;
    }
    sum = r - l;
    if (len(l) != 1) sum /= 10;
    cout << sum + 1 << endl;
  } else {
    long long int x = r;
    while (!(F_L(l))) l++;
    while (!(F_L(r))) r--;
    sum += lower_part2(l);
    if (len(r) == len(x)) sum += upper_part2(r);
    for (int i = len(l) + 1; i < len(x); i++) {
      for (int j = 0; j < 9; j++) sum += ten[i - 1];
    }
    cout << sum << endl;
  }
  return 0;
}
