@staticmethod
def d():
    ng = set([4, 9])

    def count(d):
        return (d if (d <= 4) else (d - 1))

    def f(n):
        x = [int(d) for d in str(n)]
        flg = True
        dp = 0
        for d in x:
            dp = ((dp * 8) + (flg * count(d)))
            if (d in ng):
                flg = False
        return (n - (dp + flg))
    (a, b) = map(int, sys.stdin.readline().split())
    print((f(b) - f((a - 1))))
@staticmethod
def d():
    ng = set([4, 9])

    def count(d):
        return (d if (d <= 4) else (d - 1))

    def f(n):
        x = [int(d) for d in str(n)]
        flg = True
        dp = 0
        for d in x:
            dp = ((dp * 8) + (flg * count(d)))
            if (d in ng):
                flg = False
        return (n - (dp + flg))
    (a, b) = map(int, sys.stdin.readline().split())
    print((f(b) - f((a - 1))))