#include <bits/stdc++.h>
using namespace std;
long long find(string x) {
  if (x.size() == 1) return (x[0] - '0');
  long long ans = 0;
  long long len = x.size();
  for (long long i = 1; i < len; i++) {
    ans += 9 * pow(10, max((long long)0, len - 2 - i));
  }
  ans += (x[0] - '0' - 1) * pow(10, max((long long)0, len - 2));
  long long temp1 = 0, temp2 = 0;
  for (long long i = 0; i < len; i++) {
    temp1 = (temp1 * 10) + (long long)(x[i] - '0');
    if (i == 0 || i == len - 1)
      temp2 = (temp2 * 10) + (long long)(x[0] - '0');
    else
      temp2 = (temp2 * (long long)10);
  }
  if (temp1 >= temp2) ans += (temp1 - temp2) / 10 + 1;
  return ans;
}
int main() {
  string a, b;
  cin >> a >> b;
  long long flag = 0;
  if (a[0] == a[a.size() - 1]) flag = 1;
  cout << find(b) - find(a) + flag << "\n";
  return 0;
}
