#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e5 + 4;
vector<int> v;
long long dp[20][2][10];
long long rec(int ind, int flag, int start, int prev) {
  if (ind == v.size()) return prev == start;
  long long &here = dp[ind][flag][start];
  if (here != -1) return here;
  int lim;
  if (flag)
    lim = 9;
  else
    lim = v[ind];
  here = 0;
  int st = 0;
  if (ind == 0) st = 1;
  for (int i = st; i < lim + 1; i++) {
    int hf = flag, hs = start, hp;
    hp = i;
    if (i < lim) hf = 1;
    if (ind == 0) hs = i;
    here += rec(ind + 1, hf, hs, hp);
  }
  return here;
}
long long fun(long long n) {
  v.clear();
  while (n) {
    v.push_back(n % 10);
    n /= 10;
  }
  reverse(v.begin(), v.end());
  memset(dp, -1, sizeof(dp));
  long long here = rec(0, 0, 0, 0);
  return here;
}
long long solve(long long n) {
  if (n == 0) return 0;
  long long here = 0, cur = 10;
  while (cur - 1LL < n) here += fun(cur - 1LL), cur *= 10LL;
  here += fun(n);
  return here;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = solve(r) - solve(l - 1);
  printf("%lld", ans);
  return 0;
}
