#include <bits/stdc++.h>
using namespace std;
long long pow1(long long a, long long b) {
  long long ans = 1;
  while (b > 0) ans *= a, b--;
  return ans;
}
long long calc(string a) {
  if (a.length() == 1) return a[0] - '0';
  long long ans = 0;
  ans += max(0LL,
             (long long)(a[0] - '0' - 1) * (long long)pow1(10, a.length() - 2));
  if ((a[0] - '0') != 0) {
    long long tmp = 0;
    for (long long i = 1; i < a.length() - 1; i++) {
      tmp = tmp * 10 + a[i] - '0';
    }
    if (a[a.length() - 1] < a[0]) tmp--;
    ans += (tmp + 1);
  }
  for (long long i = 1; i <= a.length() - 1; i++) {
    ans += 9 * max((long long)pow1(10, i - 2), 1LL);
  }
  return ans;
}
int main() {
  string a, b;
  long long bb;
  cin >> bb >> b;
  bb--;
  if (bb == 0)
    a = "0";
  else {
    while (bb) {
      a += (bb % 10 + '0');
      bb /= 10;
    }
  }
  reverse((a).begin(), (a).end());
  cout << calc(b) - calc(a) << endl;
}
