#include <bits/stdc++.h>
using namespace std;
long long pre[20];
long long deal(char x[]) {
  long long cur = 0;
  int len = strlen(x + 1);
  for (int i = 1; i < len; i++) {
    if (i - 2 < 0)
      cur += 9;
    else
      cur += 1ll * 9 * pre[i - 2];
  }
  if (len - 2 >= 0)
    cur += (x[1] - '1') * 1ll * pre[len - 2];
  else
    cur += (x[1] - '1');
  long long mm = 0;
  for (int i = 2; i < len; i++) mm = mm * 10 + (x[i] - '0');
  if (x[1] > x[len]) mm--;
  cur += mm + 1;
  return cur;
}
int main() {
  char n[30], m[30];
  long long nn;
  pre[0] = 1;
  for (int i = 1; i <= 18; i++) pre[i] = pre[i - 1] * 10;
  scanf("%I64d", &nn);
  scanf("%s", m + 1);
  nn--;
  if (nn == 0)
    n[1] = '0', n[2] = '\0';
  else {
    int len = 0, j = 1;
    char tp[30];
    while (nn) {
      tp[len++] = nn % 10 + '0';
      nn /= 10;
    }
    len--;
    while (len >= 0) n[j++] = tp[len--];
    n[j] = '\0';
  }
  long long ans = deal(m) - deal(n);
  printf("%I64d\n", ans);
  return 0;
}
