# -*- coding: utf-8 -*- def calcx12x(A): if A < 12: return 0 strA = str(A) Alist =map(int, list(strA)) N = len(Alist) tcnt = 0 for i in range(1, N): cnt = 0 tmp = str(Alist[i-1]) + str(Alist[i]) Atop = "0" Abot = "0" for j in range(0, i-1): Atop += str(Alist[j]) if int(tmp) == 12: for j in range(i+1, N): Abot += str(Alist[j]) cnt = int(Atop) * 10 ** (N-i-1) + int(Abot) + 1 elif int(tmp) < 12: cnt = int(Atop) * 10 ** (N-i-1) elif int(tmp) > 12: cnt = (int(Atop)+1) * 10 ** (N-i-1) tcnt += cnt return tcnt def calc2xx1(A): strA = str(A) Alist =map(int, list(strA)) N = len(Alist) if A == 2: return 1 exit() cnt = "0" tot = 0 if Alist[0] == 2: cnt += "1" * (N-2) cnt2 ="0" for i in range(1,N-1): cnt2 += str(Alist[i]) intcnt2 = int(cnt2) if Alist[N-1] < 2: intcnt2 -= 1 tot = int(cnt) + intcnt2 + 1 elif Alist[0] < 2: if 2 < N: cnt += "1" * (N-2) tot = int(cnt) elif 2 < Alist[0]: cnt += "1" * (N-1) tot = int(cnt) if A < 2: tot = 0 else: tot = tot + 1 return tot A, B = map(int, raw_input().split()) AAA = calcx12x(B) - calcx12x(A-1) BBB = calc2xx1(B) - calc2xx1(A-1) strA = str(A-1) Alist =map(int, list(strA)) strB = str(A) Blist =map(int, list(strB)) if Alist[len(Alist)-1] == 1 and Blist[0] == 2: print AAA + BBB - 1 else: print AAA + BBB