#include <bits/stdc++.h>
using namespace std;
unsigned long long table[20];
unsigned long long ten[20];
void init() {
  int i;
  table[1] = 9;
  table[2] = table[1] + 9;
  unsigned long long t = 9;
  for (i = 3; i < 19; ++i) {
    t = t * 10;
    table[i] = table[i - 1] + t;
  }
  ten[0] = 1;
  for (i = 1; i < 19; ++i) ten[i] = ten[i - 1] * 10;
}
unsigned long long f(unsigned long long x) {
  stringstream ss;
  ss << x;
  string num = ss.str();
  int len = num.size();
  if (len == 1) return x;
  int fdigit = num[0] - '0';
  int ldigit = num[len - 1] - '0';
  unsigned long long ret =
      table[len - 1] + (fdigit - 1) * ten[len - 2] + (fdigit <= ldigit);
  unsigned long long mid = (x - fdigit * ten[len - 1] - ldigit) / 10;
  return ret + mid;
}
int main() {
  init();
  unsigned long long a, b;
  cin >> a >> b;
  cout << f(b) - f(a - 1) << endl;
  return 0;
}
