import std.stdio;

bool isKaibun(int i) {
    int[5] r;
    foreach (n; 0 .. 5) {
        r[n] = i % 10;
        i /= 10;
    }
    return r[0] == r[4] && r[1] == r[3];
}

void main() {
    int a, b;
    readf("%d %d\n", &a, &b);
    size_t n = 0;
    foreach (i; a..b+1) {
        if (isKaibun(i)) {
            ++n;
        }
    }
    writeln(n);
}
