Tmp = []

Tmp  = input().rstrip().split(' ')



A = int(Tmp[0])

B = int(Tmp[1])



Ans = 0

Data = A

while Data <= B:

    C = Data // 10000

    D = (Data - C * 10000 )// 1000

    E = Data // 100

    F = (Data - E * 100 )// 10

    G = Data % 10

    if (C==G) and (D==F):

        Ans += 1    

    Data += 1 



print(Ans)



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



N = B - A + 1

Ans = 0



for i in range(N):

  TmpN = A + i

  S = str(TmpN)

  if S[0]==S[4] and S[1]==S[3]:

    Ans += 1



print(Ans)

  

  



Tmp = []
Tmp = input().rstrip().split(" ")
A = int(Tmp[0])
B = int(Tmp[1])
Ans = 0
Data = A
while Data <= B:
    C = Data // 10000
    D = (Data - C * 10000) // 1000
    E = Data // 100
    F = (Data - E * 100) // 10
    G = Data % 10
    if (C == G) and (D == F):
        Ans += 1
    Data += 1
print(Ans)

A, B = list(map(int, input().split()))
N = B - A + 1
Ans = 0
for i in range(N):
    TmpN = A + i
    S = str(TmpN)
    if S[0] == S[4] and S[1] == S[3]:
        Ans += 1
print(Ans)

-Tmp = [] -Tmp = input().rstrip().split(" ") -A = int(Tmp[0]) -B = int(Tmp[1]) +A, B = list(map(int, input().split())) +N = B - A + 1 -Data = A -while Data <= B: -    C = Data // 10000 -    D = (Data - C * 10000) // 1000 -    E = Data // 100 -    F = (Data - E * 100) // 10 -    G = Data % 10 -    if (C == G) and (D == F): +for i in range(N): +    TmpN = A + i +    S = str(TmpN) +    if S[0] == S[4] and S[1] == S[3]: -    Data += 1