#include <bits/stdc++.h>
using namespace std;
long long int dp[20][10][2];
long long int solve(string a, int n, int ff = -1, bool f = 0) {
  if (n == 0) return 1LL;
  if (ff != -1 && dp[n][ff][f] != -1) return dp[n][ff][f];
  long long int ret = 0;
  if (n == a.length()) {
    for (int i = 1; i < a[a.length() - n] - '0'; i++)
      ret += solve(a, n - 1, i, 1);
    ret += solve(a, n - 1, a[a.length() - n] - '0', 0);
  } else if (n != 1) {
    if (f)
      ret += 10 * solve(a, n - 1, ff, 1);
    else {
      for (int i = 0; i < a[a.length() - n] - '0'; i++)
        ret += solve(a, n - 1, i, 1);
      ret += solve(a, n - 1, ff, 0);
    }
  } else {
    if (f)
      ret += solve(a, n - 1, ff, 1);
    else if (a[a.length() - n] - '0' >= ff)
      ret += solve(a, n - 1, ff, 0);
  }
  if (ff != -1) dp[n][ff][f] = ret;
  return ret;
}
long long int mpow(long long int a, long long int b) {
  if (b <= 0) return 1;
  long long int ret = 1;
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b /= 2;
  }
  return ret;
}
int main() {
  memset((dp), (-1), sizeof(dp));
  string a, b;
  long long int ans = 0;
  cin >> a >> b;
  for (int i = a.length(); i < b.length(); i++) ans += 9 * mpow(10, i - 2);
  cerr << "ans"
       << ": " << ans << endl;
  ;
  ans += solve(b, b.length());
  cerr << "ans"
       << ": " << ans << endl;
  ;
  memset((dp), (-1), sizeof(dp));
  ans -= solve(a, a.length());
  ans += (a[0] == a[a.length() - 1]);
  cout << ans << "\n";
  return 0;
}
