#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d;
long long ans = 0;
long long a1 = 0, b1 = 0;
long long a2[30], b2[30];
int main() {
  cin >> a >> b;
  c = a;
  d = b;
  while (c > 0) {
    a2[a1++] = c % 10;
    c /= 10;
  }
  while (d > 0) {
    b2[b1++] = d % 10;
    d /= 10;
  }
  if (a1 < b1) {
    long long u = 0;
    for (int i = a1 + 1; i < b1; i++) {
      u = 9;
      for (int j = 0; j < i - 2; j++) u *= 10;
      ans += u;
    }
    if (a2[a1 - 1] >= a2[0]) ans++;
    if (a1 - 1 == 0) ans += 9 - a2[0];
    for (int i = a1 - 1; i > 0; i--) {
      u = 9 - a2[i];
      for (int j = i - 1; j > 0; j--) u *= 10;
      ans += u;
    }
    if (b2[b1 - 1] <= b2[0]) ans++;
    for (int i = b1 - 1; i > 0; i--) {
      u = b2[i];
      if (i == b1 - 1) u--;
      if (u < 0) continue;
      for (int j = i - 1; j > 0; j--) u *= 10;
      ans += u;
    }
  }
  if (a1 == b1) {
    long long u = 0;
    u = 9;
    for (int j = 0; j < a1 - 2; j++) u *= 10;
    ans += u;
    if (a2[a1 - 1] < a2[0]) ans--;
    if (a1 - 1 == 0) ans -= a2[0] - 1;
    for (int i = a1 - 1; i > 0; i--) {
      u = a2[i];
      if (i == a1 - 1) u--;
      if (u < 0) continue;
      for (int j = i - 1; j > 0; j--) u *= 10;
      ans -= u;
    }
    if (b2[b1 - 1] > b2[0]) ans--;
    if (b1 - 1 == 0) ans -= 9 - b2[0];
    for (int i = b1 - 1; i > 0; i--) {
      u = 9 - b2[i];
      for (int j = i - 1; j > 0; j--) u *= 10;
      ans -= u;
    }
  }
  cout << ans;
  getchar();
  getchar();
}
