#include <bits/stdc++.h>
using namespace std;
long long ans, dp[20];
string l, r;
int main() {
  cin >> l >> r;
  dp[0] = 1;
  for (int i = 1; i < 19; i++) dp[i] = dp[i - 1] * 10;
  for (int i = (int)l.size() + 1; i < (int)r.size(); i++) ans += 9 * dp[i - 2];
  int num = 10;
  if ((int)l.size() == (int)r.size()) num = r[0] - '0';
  for (int i = l[0] - '0' + 1; i < num; i++) {
    if (l.size() >= 2)
      ans += dp[(int)l.size() - 2];
    else
      ans++;
  }
  num = 1;
  if ((int)l.size() == (int)r.size()) num = l[0] - '0' + 1;
  if ((int)l.size() != (int)r.size()) {
    for (int i = num; i < r[0] - '0'; i++) {
      if (r.size() >= 2)
        ans += dp[(int)r.size() - 2];
      else
        ans++;
    }
  }
  long long a = 0, c = 0;
  for (int i = 1; i < (int)l.size() - 1; i++) {
    a *= 10;
    a += l[i] - '0';
  }
  for (int i = 1; i < (int)r.size() - 1; i++) {
    c *= 10;
    c += r[i] - '0';
  }
  long long b = 1;
  if ((int)l.size() > 1) b = dp[(int)l.size() - 2];
  if ((int)l.size() == (int)r.size() && l[0] == r[0]) b = c;
  ans += b - a;
  if ((int)r.size() - 2 > 0) {
    if ((int)l.size() != (int)r.size() || l[0] != r[0]) ans += c;
  }
  if (l[0] < l[l.size() - 1]) ans--;
  if (r[0] <= r[r.size() - 1]) ans++;
  cout << ans << endl;
  return 0;
}
