A,B = list(map(int,input().split()))

#greedy O(B-A)*len(B)(=5)

kaibun = 0 # num of kaibun

for i in range(A,B+1,1):

  s = str(i)

  #print(s)

  for i in range(len(s)):

    if s[i] != s[len(s)-1-i]:

      break

    if i == len(s)-1:

      kaibun += 1

print(kaibun)

    
# 回文数になるA<= <=Bの数の個数

a,b = list(map(int,input().split()))

ans = 0

for i in range(a,b+1,1):

    s = str(i)

    if s == s[::-1]:

        ans += 1

print(ans)

A, B = list(map(int, input().split()))
# greedy O(B-A)*len(B)(=5)
kaibun = 0  # num of kaibun
for i in range(A, B + 1, 1):
    s = str(i)
    # print(s)
    for i in range(len(s)):
        if s[i] != s[len(s) - 1 - i]:
            break
        if i == len(s) - 1:
            kaibun += 1
print(kaibun)

# 回文数になるA<= <=Bの数の個数
a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1, 1):
    s = str(i)
    if s == s[::-1]:
        ans += 1
print(ans)

-A, B = list(map(int, input().split())) -# greedy O(B-A)*len(B)(=5) -kaibun = 0  # num of kaibun -for i in range(A, B + 1, 1): +# 回文数になるA<= <=Bの数の個数 +a, b = list(map(int, input().split())) +ans = 0 +for i in range(a, b + 1, 1): -    # print(s) -    for i in range(len(s)): -        if s[i] != s[len(s) - 1 - i]: -            break -        if i == len(s) - 1: -            kaibun += 1 -print(kaibun) +    if s == s[::-1]: +        ans += 1 +print(ans)