l,r=list(map(int,input().split()))
def count_two(a,b):
    cnt=0
    for x in range(l,r+1):
        x=str(x)
        cnt+=x.count('2')
    return cnt
print(count_two(l,r))