#include <bits/stdc++.h>
using namespace std;
long long num[20], ten[20];
bool judge(long long n, int m) { return n / ten[m - 1] == n % 10; }
int getBit(long long n) {
  int ret = 0;
  while (n) {
    n /= 10;
    ret++;
  }
  return ret;
}
long long gao(long long n) {
  long long ret = 0;
  int m = getBit(n);
  if (n <= 99) {
    for (long long i = 0; i <= n; i++) {
      int j = getBit(i);
      ret += judge(i, j);
    }
    return ret;
  }
  for (int i = 0; i < m; i++) {
    ret += num[i];
  }
  int a = n / ten[m - 1];
  int b = n % 10;
  ret += ten[m - 2] * (a - 1);
  if (b >= a) {
    ret += (n % ten[m - 1]) / 10 + 1;
  } else {
    ret += (n % ten[m - 1]) / 10;
  }
  return ret;
}
int main() {
  num[0] = 1;
  num[1] = num[2] = 9;
  for (int i = 3; i < 20; i++) {
    num[i] = num[i - 1] * 10;
  }
  ten[0] = 1;
  for (int i = 1; i < 20; i++) {
    ten[i] = ten[i - 1] * 10;
  }
  long long l, r;
  while (cin >> l >> r) {
    long long a = gao(l - 1);
    long long b = gao(r);
    long long ans = b - a;
    cout << ans << endl;
  }
  return 0;
}
