#include <bits/stdc++.h>
using namespace std;
long long d[20];
long long mypow(long long x, int k) {
  long long ret = 1;
  while (k--) ret *= x;
  return ret;
}
int pow10(long long x) {
  int ret = 0;
  while (x >= 10) {
    x /= 10, ++ret;
  }
  return ret;
}
int fd(long long x) {
  while (x >= 10) {
    x /= 10;
  }
  return x;
}
bool isGood(long long x) { return x % 10 == fd(x); }
int tupoe(long long x) {
  int ret = 0;
  for (int i = 1; i <= x; ++i) ret += isGood(i);
  return ret;
}
long long calc(long long x) {
  if (!x) return 0;
  long long ans = 0;
  while (!isGood(x)) {
    --x;
  }
  if (x < 100) return tupoe(x);
  long long tmp = x;
  int a[20], sz = 0;
  while (tmp) {
    a[sz++] = tmp % 10;
    tmp /= 10;
  }
  for (int i = sz - 2; i > 0; --i) {
    ans = ans * 10 + a[i];
  }
  long long tmp1 = ((a[sz - 1] - 1) * (mypow(10, sz - 2)));
  ++ans;
  ans += tmp1;
  for (int i = 1; i <= sz - 1; ++i) ans += d[i];
  return ans;
}
int main() {
  long long l, r;
  d[1] = d[2] = 9;
  for (int i = 3; i < 18; ++i) d[i] = d[i - 1] * 10;
  cin >> l >> r;
  cout << calc(r) - calc(l - 1);
  return 0;
}
