#include <bits/stdc++.h>
using namespace std;
long long memo[22][2][2][10][10];
bool done[22][2][2][10][10];
struct Number {
  int nDig, dig[22];
  long long val;
  void init() {
    long long tmp = val;
    nDig = 0;
    while (tmp) {
      dig[nDig++] = tmp % 10;
      tmp /= 10;
    }
  }
} low, high;
long long dp(int n, int hs, int ls, int fd, int ld) {
  if (done[n][hs][ls][fd][ld]) return memo[n][hs][ls][fd][ld];
  done[n][hs][ls][fd][ld] = true;
  long long &ret = memo[n][hs][ls][fd][ld];
  if (n == 0) return ret = fd == ld;
  int lb = ls ? low.dig[n - 1] : 0, hb = hs ? high.dig[n - 1] : 9;
  for (int x = lb; x <= hb; x++) {
    int nld = n == 1 ? x : 0, nfd = fd == 0 ? x : fd;
    ret += dp(n - 1, hs && x == hb, ls && x == lb, nfd, nld);
  }
  return ret;
}
int main() {
  cin >> low.val >> high.val;
  low.init(), high.init();
  cout << dp(high.nDig, 1, 1, 0, 0);
}
