#include <bits/stdc++.h>
using namespace std;
int first(long long x) {
  int r;
  while (x) {
    r = x;
    x /= 10;
  }
  return r;
}
int last(long long x) { return x % 10; }
long long _10[20];
long long getans(long long x) {
  if (x < 10)
    return x;
  else if (x == 10)
    return 9;
  long long ans = x;
  int weishu = -1;
  while (ans) {
    weishu++;
    ans /= 10;
  }
  while (first(x) != last(x)) x--;
  if (x < 100) return 9 + x % 10;
  long long ss, ee;
  ss = ee = last(x);
  ss *= _10[weishu - 1];
  ans += (x - ss - ee) / 10 + 1;
  ss /= 10 * ee;
  ans += (ee - 1) * ss;
  ss *= 10;
  if (weishu > 0) ans += 9;
  while (ss > 10) {
    ans += 9 * (ss / 100);
    ss /= 10;
  }
  return ans;
}
int main() {
  _10[0] = 1;
  for (int i = 1; i < 20; i++) _10[i] = _10[i - 1] * 10;
  long long l, r;
  cin >> l >> r;
  long long ans = 0;
  ans = getans(r) - getans(l);
  if (first(l) == last(l)) ans++;
  cout << ans << endl;
}
