#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1000000;
long long L, R;
int log_10(long long A) {
  int len = 0;
  while (A) {
    A /= 10;
    len++;
  }
  return len;
}
long long step(long long a, long long n) {
  long long res = 1;
  for (int i = 0; i < n; i++) res *= a;
  return res;
}
bool correct(int A) {
  vector<int> C;
  while (A) {
    C.push_back(A % 10);
    A /= 10;
  }
  reverse(C.begin(), C.end());
  long long C0 = C[0];
  long long CL = C[C.size() - 1];
  return C0 == CL;
}
long long solve(long long R) {
  int L = log_10(R);
  if (R <= 0) return 0;
  if (L == 1 || L == 0) return R;
  if (L == 2) {
    int ANS = 0;
    for (int i = step(10, L - 1); i <= R; i++)
      if (correct(i)) ANS++;
    return ANS;
  }
  long long ans = 0;
  vector<int> C;
  long long OR = R;
  while (OR) {
    C.push_back(OR % 10);
    OR /= 10;
  }
  reverse(C.begin(), C.end());
  long long C0 = C[0];
  long long CL = C[L - 1];
  long long DA = (C0 - 1) * max(step(10, L - 2), 1ll);
  long long DB = max((R - (C0 * step(10, L - 1) + C0)) / 10 + 1, 0ll);
  if (R < (C0 * step(10, L - 1) + C0)) DB = 0;
  return DA + DB;
}
long long real_solve(long long R) {
  long long L = log_10(R);
  long long Q = 0;
  for (int i = 1; i < L; i++) Q += 9 * max(step(10, i - 2), 1ll);
  long long S = solve(R);
  return Q + S;
}
void stress_test() {
  while (true) {
    long long ANS = 0;
    long long k = rand() % 10000 + 1;
    for (int i = 1; i <= k; i++)
      if (correct(i)) ANS++;
    if (real_solve(k) != ANS) {
      cout << "INCORRECT: " << endl;
      cout << "TEST: " << k << endl;
      cout << "OUTPUT: " << real_solve(k) << endl;
      cout << "ANSWER: " << ANS << endl;
      break;
    } else {
      cout << "CORRECT" << endl;
    }
  }
}
int main() {
  cin >> L >> R;
  cout << real_solve(R) - real_solve(L - 1) << endl;
  return 0;
}
