#include <bits/stdc++.h>
using namespace std;
int N;
unsigned long long int n, k;
inline void read(void) {}
unsigned long long int pw(unsigned long long int a, unsigned long long int b) {
  if (b == 0) return 1;
  unsigned long long int ans = 1;
  for (unsigned long long int i = (0); i < (b); i++) ans = ans * a;
  return ans;
}
unsigned long long int f(char* s) {
  int len = strlen(s);
  if (len == 1) {
    return s[0] - '0';
  } else {
    unsigned long long int ans = 9;
    unsigned long long int x0 = 0;
    for (unsigned long long int i = (1); i < (len - 1); i++) {
      x0 = (10 * x0) + s[i] - '0';
    }
    for (unsigned long long int d = (1); d < (10); d++) {
      for (unsigned long long int i = (0); i < (len - 1); i++) {
        if (i < len - 2 || (i == len - 2 && d < s[0] - '0')) {
          ans += pw(10, i);
        } else if (i == len - 2 && d == s[0] - '0') {
          ans += x0;
          if (s[len - 1] - '0' >= d) {
            ans += 1;
          }
        }
      }
    }
    return ans;
  }
}
char a[25];
char b[25];
void solve() {
  unsigned long long int l, r;
  cin >> l >> r;
  if (l > r) swap(l, r);
  l -= 1;
  int i = 0;
  unsigned long long int temp = l;
  while (temp) {
    i++;
    temp /= 10;
  }
  temp = l;
  int len = i;
  i = 0;
  while (temp) {
    a[len - 1 - i++] = temp % 10 + '0';
    temp /= 10;
  }
  if (len == 0) {
    a[len] = '0';
    a[len + 1] = '\0';
  } else
    a[len] = '\0';
  temp = r;
  i = 0;
  while (temp) {
    i++;
    temp /= 10;
  }
  temp = r;
  len = i;
  i = 0;
  while (temp) {
    b[len - 1 - i++] = temp % 10 + '0';
    temp /= 10;
  }
  b[len] = '\0';
  cout << f(b) - f(a) << endl;
}
int main() {
  solve();
  return 0;
}
