#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll mpow(ll a, ll n) {
  ll r = 1;
  while (n) {
    if (n & 1) r = r * a;
    a = a * a;
    n >>= 1;
  }
  return r;
}
ll calc(ll n) {
  if (n <= 9) return n;
  vector<int> digs;
  while (n) {
    digs.push_back(n % 10);
    n /= 10;
  }
  reverse(digs.begin(), digs.end());
  int k = digs.size();
  ll ret = 0;
  for (int i = 1; i < digs[0]; ++i) {
    int rem = k - 2;
    ret += mpow(10, rem);
  }
  for (int pos = 1; pos < k - 1; ++pos) {
    int rem = k - 2 - pos;
    if (rem < 0) break;
    for (int dig = 0; dig < digs[pos]; ++dig) ret += mpow(10, rem);
  }
  if (digs[0] <= digs[k - 1]) ++ret;
  ret += 9;
  for (int len = 2; len < k; ++len) {
    int rem = len - 2;
    ret += 9 * mpow(10, rem);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll l, r;
  cin >> l >> r;
  cout << calc(r) - calc(l - 1);
}
