#happy b1rthday 2 me
def comb(n, m)
    q = 1
    m.times do |x|
        q *= n - x
        q /= (x + 1)
    end
    return q
end
a, b = gets.split
if a == b
    count = 0
    (a.length - 1).times do |i|
        count += 1 if a[i, 2] == "12"
    end
    puts count
    exit
end
an, bn = a.to_i, b.to_i
la = a.length
lb = b.length
res = 0
ch = 0
ss = ""
=begin
(a.to_i).upto(b.to_i) do |x|
    ss += x.to_s
end
(ss.length - 1).times do |i|
    ch += 1 if ss[i, 2].to_i == 12
end
puts ch
=end
la.upto(lb) do |x|
    if x == 1
        res += 1
        next
    end
    d = x - 2
    res += 10 ** d
    res += d * 9 * 10 ** (d - 1) if d > 0
    if x >= 3
        res += 10 ** (x - 2)
    else
        res += 1
    end
end
y = 2
(la - y).downto(0) do |i|
    j = la - i - y
    q = 0
    mid = a[i, y].to_i
    left = a[0, i].to_i
    right = a[i + y, j].to_i
    if i == 0
        if mid > 12
            q += 10 ** j
        elsif mid == 12
            q += right
        end
    elsif i == la - y
        q += left - 10 ** (i - 1)
        q += 1 if mid > 12
    else
        if mid > 12
            q += (left - 10 ** (i - 1) + 1) * 10 ** j
        elsif mid < 12
            q += (left - 10 ** (i - 1)) * 10 ** j
        else
            q += (left - 10 ** (i - 1)) * 10 ** j
            q += right
        end
    end
    res -= q
end
if a.length - 2 >= 0
    if a[0].to_i > 2
        res -= 10 ** (a.length - 2)
    elsif a[0].to_i == 2
        res -= a[1, a.length - 2].to_i + 1
        res += 1 if a[a.length - 1].to_i < 2
    end
else
    if a[0].to_i >= 2
        res -= 1
    end
end
(lb - y).downto(0) do |i|
    j = lb - i - y
    q = 0
    mid = b[i, y].to_i
    left = b[0, i].to_i
    right = b[i + y, j].to_i
    if i == 0
        if mid < 12
            q += 10 ** j
        elsif mid == 12
            q += 10 ** j - right - 1
        end
    elsif i == lb - y
        q += 10 ** i - left
        q -= 1 if mid >= 12
    else
        if mid < 12
            q += (10 ** i - left) * 10 ** j
        elsif mid > 12
            q += (10 ** i - left - 1) * 10 ** j
        else
            q += (10 ** i - left - 1) * 10 ** j
            q += 10 ** j - right - 1
        end
    end
    res -= q
end
if b.length - 2 >= 0
    if b[0].to_i < 2
        res -= 10 ** (b.length - 2)
    elsif b[0].to_i == 2
        res -= 10 ** (b.length - 2) - b[1, b.length - 2].to_i
        res += 1 if b[b.length - 1].to_i >= 2
    end
end
puts res