#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
template <class T>
bool inside(T a, T b, T c) {
  return (b >= a && b <= c);
}
const long long INF64 = (long long)1E16;
long long distsq2d(long long x1, long long y1, long long x2, long long y2) {
  return sqr(x1 - x2) + sqr(y1 - y2);
}
double dist2d(double x1, double y1, double x2, double y2) {
  return sqrt(sqr(x1 - x2) + sqr(y1 - y2));
}
double dist3d(double x1, double y1, double z1, double x2, double y2,
              double z2) {
  return sqrt(sqr(x1 - x2) + sqr(y1 - y2) + sqr(z1 - z2));
}
long long toInt64(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double LOG(long long N, long long B) { return (log10l(N)) / (log10l(B)); }
vector<string> token(string a, string b) {
  const char *q = a.c_str();
  while (count(b.begin(), b.end(), *q)) q++;
  vector<string> oot;
  while (*q) {
    const char *e = q;
    while (*e && !count(b.begin(), b.end(), *e)) e++;
    oot.push_back(string(q, e));
    q = e;
    while (count(b.begin(), b.end(), *q)) q++;
  }
  return oot;
}
string itoa(long long a) {
  if (a == 0) return "0";
  string ret;
  for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);
  reverse(ret.begin(), ret.end());
  return ret;
}
string s;
long long dp[22][25][10];
long long call(int fd, int idx, int choto) {
  long long lo, up = 9;
  if (idx == 0)
    lo = 1;
  else
    lo = 0;
  if (choto <= 1) {
    if (idx == (int)s.size()) return 0;
  }
  if (choto == 2) {
    if (idx == (int)s.size() - 1) return 0;
  }
  if (dp[fd][idx][choto] != -1) return dp[fd][idx][choto];
  long long ret = 0;
  for (int i = lo; i <= up; i++) {
    if (idx == 0 and i != fd) continue;
    int send = 0;
    if (choto == 0) {
      if (i < s[idx] - '0') send = 1;
      if (i > s[idx] - '0') {
        if (idx == (int)s.size() - 1) continue;
        send = 2;
      }
    } else
      send = choto;
    ret += call(fd, idx + 1, send) + (i == fd);
  }
  return dp[fd][idx][choto] = ret;
}
long long get(long long n) {
  memset(dp, -1, sizeof(dp));
  ;
  s = itoa(n);
  long long ans = 0;
  for (int fd = 1; fd <= 9; fd++) ans += call(fd, 0, 0);
  return ans;
}
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = get(b) - get(a);
  string s = itoa(a);
  if (s[0] == s[s.size() - 1]) ans++;
  cout << ans << endl;
}
