#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp[20][20][20]{};
ll cnt(int i, int lo, int hi, string s, int n) {
  if (~dp[i][lo][hi]) return dp[i][lo][hi];
  ll res = 0;
  if (i == n - 1) {
    if (lo <= hi) return 1;
    return 0;
  } else {
    for (int d = (i == 0); d < 10; ++d) {
      int lo1 = lo;
      int hi1 = hi;
      if (d < s[i] - '0') lo1 = min(lo1, i);
      if (d > s[i] - '0') hi1 = min(hi1, i);
      if (i == 0 && d > s[n - 1] - '0') hi1 = min(hi1, n - 1);
      res += cnt(i + 1, lo1, hi1, s, n);
    }
    dp[i][lo][hi] = res;
    return res;
  }
}
ll fun(ll x) {
  if (x <= 9LL) return x;
  ll res = 9;
  string s = to_string(x);
  int n = s.size();
  for (int i = 0; i < n - 2; ++i) res += 9 * pow(10, i);
  memset(dp, -1, sizeof dp);
  res += cnt(0, n, n, s, n);
  return res;
}
int main() {
  ll l, r;
  cin >> l >> r;
  cout << fun(r) - fun(l - 1) << '\n';
  return 0;
}
