local str1 = io.read()
local str2 = io.read()

local len = (str2) - tonumber(str1)
local count = 0
for i = tonumber(str1), tonumber(str2) do
    if(tonumber(i) == tonumber(string.reverse(i))) then
        count = count + 1
    end
end
print(count)