'''total = 0
for i in range(1, 6):
    total += i
    print(total, end='')'''
a = int(input())
b = int(input())
counter = 0
for i in range(a,b + 1):
    print('counter','=', counter )
    if (i**3)%10 == 4 or (i**3)%10 == 9:
        counter += 1
print(counter)