#include <bits/stdc++.h>
using namespace std;
long long rev(long long x) {
  long long ans = 0;
  while (x) {
    ans *= 10;
    ans += x % 10;
    x /= 10;
  }
  return ans;
}
long long ok(long long i) { return (rev(i) % 10 == i % 10 ? 1LL : 0LL); }
long long mudah(long long x) {
  long long ans = 0;
  for (long long i = 1; i <= x; i++) ans += ok(i);
  return ans;
}
long long ho(long long x) {
  long long ans = 1LL;
  for (int i = 0; i < x; i++) ans *= 10LL;
  return ans;
}
long long p(long long x) {
  long long ans = 0;
  while (x) {
    x /= 10;
    ans++;
  }
  return ans;
}
long long get(long long x) {
  x -= (rev(x) % 10LL) * ho(p(x) - 1);
  return x / 10LL;
}
long long solve(long long x) {
  long long lo[20], wo[20];
  lo[0] = 9;
  lo[1] = 9;
  for (int i = 2; i < 18; i++) lo[i] = lo[i - 1] * 10LL;
  wo[0] = 9;
  wo[1] = 99;
  for (int i = 2; i < 18; i++) wo[i] = wo[i - 1] * 10LL + 9LL;
  long long ans = 0, pil = 0;
  for (int i = 0; i < 18; i++)
    if (x > wo[i]) ans += lo[i];
  long long haha = rev(x) % 10;
  ans += (haha - 1LL) * ho(p(x) - 2);
  ans += get(x);
  if (x < ((x / 10LL * 10LL) + haha)) ans--;
  return ans;
}
int main() {
  long long a, b;
  while (cin >> a >> b) {
    if (b < 10000000)
      cout << mudah(b) - mudah(a - 1) << endl;
    else
      cout << solve(b) - solve(a - 1) << endl;
  }
  return 0;
}
