#include <bits/stdc++.h>
using namespace std;
inline void readnr(string &x, string &y) {
  char c = getchar();
  while (c != ' ') {
    x = x + c;
    c = getchar();
  }
  c = getchar();
  while (c != '\n') {
    y = y + c;
    c = getchar();
  }
}
long long c[20];
long long solve(string nr) {
  int len = nr.length();
  long long ans = 0;
  for (int i = 1; i < len; i++) ans += 9 * c[i];
  for (int i = 1; i < nr[0] - '0'; i++) ans += c[len];
  if (nr[0] > nr[len - 1]) {
    int v = 1;
    if (len == 2) return ans;
    for (int i = len - 2; i > 0; i--) {
      int k = nr[i] - '0';
      nr[i] = (k + 10 - v) % 10 + '0';
      if (k > nr[i] - '0') v = 0;
      if (k == 0 && v == 1 && i == 1) return ans;
    }
  }
  for (int i = 1; i < len - 1; i++) ans += (nr[i] - '0') * c[len - 2 - i + 2];
  ans++;
  return ans;
}
int main() {
  string ls, rs;
  readnr(ls, rs);
  long long v = 1;
  c[0] = c[1] = 1;
  for (int i = 2; i <= 18; i++) {
    c[i] = v;
    v *= 10;
  }
  cout << solve(rs) - solve(ls) + (ls[0] == ls[ls.length() - 1]) ? 1 : 0;
  return 0;
}
