#include <bits/stdc++.h>
using namespace std;
long long P[22];
long long calc(long long a, string s) {
  if (a < 10) return a;
  long long ans = 0;
  for (int i = 0; i < s.size() - 1; i++) ans += 9ll * P[i ? i - 1 : i];
  long long b = s[0] - '0' - 1;
  ans += b * P[s.size() - 1 - 1];
  b = 0;
  for (int i = 1; i < s.size() - 1; i++) b *= 10, b += s[i] - '0';
  b += s[0] <= s.back();
  ans += b;
  return ans;
}
int main() {
  P[0] = 1;
  for (int i = 1; i < 22; i++) P[i] = P[i - 1] * 10;
  string s1, s2;
  cin >> s1 >> s2;
  stringstream s(s1);
  long long l, r;
  s >> l;
  stringstream ss(s2);
  ss >> r;
  cout << calc(r, s2) - calc(l, s1) + (s1[0] == s1.back()) << endl;
  return 0;
}
