import std.stdio, std.algorithm, std.conv, std.array, std.range, std.string, std.math, std.typecons;

auto mknm()
{
    int[100001] ret;
    int cnt;
    foreach (i; 10000..100000) {
        auto s1 = i.to!(wchar[]);
        auto s2 = s1.dup;
        s2.reverse;
        if (s1 == s2) ++cnt;
        ret[i] = cnt;
    }
    return ret;
}

enum NM = mknm();

void main()
{
    auto ab = readln.split.to!(int[]);
    writeln(NM[ab[1]] - NM[ab[0]]);
}