#include <bits/stdc++.h>
using namespace std;
bool check(long long x) {
  long long a, b;
  a = x % 10;
  while (x / 10 >= 1) x /= 10;
  b = x;
  if (a == b) return true;
  return false;
}
long long getans(long long x) {
  if (x < 10) return x;
  if (x == 10) return 9;
  while (!check(x)) x--;
  if (x < 100) return 9 + x % 10;
  int weishu = 0;
  long long k = x;
  while (k) k /= 10, weishu++;
  long long ee = x % 10;
  long long ss = ee;
  long long ans = 0;
  k = 1;
  for (int i = 1; i < weishu; i++) ss *= 10;
  ans += (x - ss - ee) / 10 + 1;
  ss /= 10 * ee;
  if (ss > 9) ans += (ee - 1) * ss;
  ss *= 10;
  ans += 9;
  while (ss > 10) ans += (ss / 100) * 9, ss /= 10;
  return ans;
}
int main() {
  long long l, r;
  cin >> l >> r;
  long long ans = getans(r) - getans(l);
  if (check(l)) ans++;
  cout << ans << endl;
}
