#include <bits/stdc++.h>
using namespace std;
long long dp[2][20];
long long l, r;
long long bits[20];
long long pwr[20];
long long solve(long long upper) {
  int cnt = 0;
  long long tmp = upper;
  while (tmp) {
    bits[cnt++] = tmp % 10;
    tmp /= 10;
  }
  if (cnt == 1) return bits[0] + 1;
  long long res = 1LL;
  for (int i = 1; i < cnt; ++i) {
    res = res + (long long)9 * pwr[max(i - 2, 0)];
  }
  for (int i = 1; i <= bits[cnt - 1]; ++i) {
    if (i < bits[cnt - 1]) {
      res += pwr[max(0, cnt - 2)];
    } else {
      memset(dp, 0, sizeof(dp));
      dp[0][0] = 1LL;
      if (i <= bits[0]) {
        dp[1][0] = 1LL;
      }
      for (int j = 1; j < cnt - 1; ++j) {
        dp[0][j] = (long long)10 * dp[0][j - 1];
        for (int k = 0; k <= 9; ++k) {
          if (k < bits[j]) {
            dp[1][j] += dp[0][j - 1];
          } else if (bits[j] == k) {
            dp[1][j] += dp[1][j - 1];
          }
        }
      }
      res += dp[1][cnt - 2];
    }
  }
  return res;
}
int main() {
  while (scanf("%I64d%I64d", &l, &r) != EOF) {
    pwr[0] = 1;
    for (int i = 1; i <= 18; ++i) pwr[i] = pwr[i - 1] * (long long)10;
    printf("%I64d\n", solve(r) - solve(l - 1));
  }
  return 0;
}
