#include <bits/stdc++.h>
using namespace std;
long long power10(int a) {
  long long ans = 1;
  for (int i = 0; i < a; i++) ans *= 10;
  return ans;
}
int degits(long long n) {
  int ans = 0;
  while (n > 0) {
    ans++;
    n /= 10;
  }
  return ans;
}
long long getgreatereq(long long a) {
  int n = degits(a);
  if (n == 1) return 10 - a;
  long long p10 = power10(n - 1);
  long long i = a / p10;
  a %= p10;
  int j = a % 10;
  a /= 10;
  if (i < j) a++;
  return (p10 / 10 - a) + (9 - i) * (p10 / 10);
}
long long getgreater(long long a) {
  int n = degits(a);
  if (n == 1) return 9 - a;
  long long p10 = power10(n - 1);
  int i = a / p10;
  int j = a % 10;
  if (i == j)
    return getgreatereq(a) - 1;
  else
    return getgreatereq(a);
}
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = getgreatereq(a);
  int n = degits(b);
  if (n == 1) {
    cout << b - a + 1 << endl;
    return 0;
  }
  for (int i = degits(a) + 1; i <= n; i++) {
    ans += power10(i - 2) * 9;
  }
  ans -= getgreater(b);
  cout << ans << endl;
}
