#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60777216")
using namespace std;
template <class type1, class type2, class type3>
struct triplet {
  type1 first;
  type3 third;
  type2 second;
  triplet(type1 __first, type2 __second, type3 __third) {
    first = __first;
    third = __third;
    second = __second;
  }
};
template <class type1, class type2, class type3>
bool operator<(const triplet<type1, type2, type3> &op1,
               const triplet<type1, type2, type3> &op2) {
  if (op1.first != op2.first) {
    return op1.first < op2.first;
  }
  if (op1.second != op2.second) {
    return op1.second < op2.second;
  }
  return op1.third < op2.third;
}
template <class type1, class type2, class type3>
triplet<type1, type2, type3> make_triplet(type1 __first, type2 __second,
                                          type3 __third) {
  return triplet<type1, type2, type3>(__first, __second, __third);
}
template <class type1, class type2, class type3, class type4>
struct poker {
  type4 four;
  type1 first;
  type3 third;
  type2 second;
  poker(type1 __first, type2 __second, type3 __third, type4 __four) {
    four = __four;
    first = __first;
    third = __third;
    second = __second;
  }
};
template <class type1, class type2, class type3, class type4>
bool operator<(const poker<type1, type2, type3, type4> &op1,
               const poker<type1, type2, type3, type4> &op2) {
  if (op1.first != op2.first) {
    return op1.first < op2.first;
  }
  if (op1.second != op2.second) {
    return op1.second < op2.second;
  }
  if (op1.third != op2.third) {
    return op1.third < op2.third;
  }
  return op1.four < op2.four;
}
template <class type1, class type2, class type3, class type4>
poker<type1, type2, type3, type4> make_poker(type1 __first, type2 __second,
                                             type3 __third, type4 __four) {
  return poker<type1, type2, type3, type4>(__first, __second, __third, __four);
}
int leng(long long n) {
  int ret = 0;
  do {
    ret++;
    n /= 10;
  } while (n);
  return ret;
}
long long powTen(int n) {
  long long ret = 1;
  for (int i = 0; i < n; ++i) {
    ret *= 10LL;
  }
  return ret;
}
long long calcIt(int len) {
  if (len == 1) {
    return 9;
  }
  return 9LL * powTen(len - 2);
}
long long LENGTH, number;
vector<int> digits;
int getI(int i) { return digits[i]; }
long long dp[15][20][2];
long long solve(int f, int pos, int mark) {
  if (pos == LENGTH) {
    if (mark) {
      return 1;
    }
    if (getI(pos) >= f) {
      return 1;
    }
    return 0;
  }
  if (dp[f][pos][mark] != -1) {
    return dp[f][pos][mark];
  }
  dp[f][pos][mark] = 0;
  if (mark) {
    for (int i = 0; i <= 9; ++i) {
      dp[f][pos][mark] += solve(f, pos + 1, 1);
    }
  } else {
    int d = getI(pos);
    for (int i = 0; i < d; ++i) {
      dp[f][pos][mark] += solve(f, pos + 1, 1);
    }
    dp[f][pos][mark] += solve(f, pos + 1, 0);
  }
  return dp[f][pos][mark];
}
long long calc(long long n) {
  int len = leng(n);
  if (len == 1) {
    return n;
  }
  if (len == 2) {
    long long ret = 9;
    for (int i = 10; i <= (int)n; ++i) {
      if (i / 10 == i % 10) {
        ret++;
      }
    }
    return ret;
  }
  long long ans = 0;
  for (int i = 1; i <= len - 1; ++i) {
    ans += calcIt(i);
  }
  LENGTH = len;
  number = n;
  digits.clear();
  digits.push_back(-1);
  memset(dp, -1, sizeof(dp));
  long long curr = n;
  while (curr) {
    digits.push_back(curr % 10);
    curr /= 10;
  }
  reverse(digits.begin() + 1, digits.end());
  long long f = n / powTen(len - 1);
  for (int i = 1; i < f; ++i) {
    ans += solve(i, 2, 1);
  }
  ans += solve(f, 2, 0);
  return ans;
}
int brute_force(int l, int r) {
  int cnt = 0;
  for (int i = l; i <= r; ++i) {
    int l = leng(i);
    if (i % 10 == i / powTen(l - 1)) {
      cnt++;
    }
  }
  return cnt;
}
int main() {
  long long l, r;
  cin >> l >> r;
  cout << calc(r) - calc(l - 1) << endl;
  return 0;
}
