def solve(L, R):
count = 0
# For each digit (1 through 9) construct numbers where the first and last digits are the same
for first_last_digit in range(1, 10):
# Single-digit numbers
if L <= first_last_digit <= R:
count += 1
# Multi-digit numbers where first and last digits are the same
multiplier = 10 # Start with 10 and go higher (like 11, 101, 1001, ...)
while True:
num = first_last_digit * multiplier + first_last_digit
if num > R:
break
if num >= L:
count += 1
multiplier *= 10 # Move to the next higher number structure
return count
# Input
L = 47#int(input())
R = 74#int(input())
# Get the output
out_ = solve(L, R)
print(out_)