print((function (f, s) return f(s) end)(function (s) local r = #s*2+1 for i=1,#s do local c = s:sub(i,i) if c=="0" or c=="4" or c=="6" or c=="9" then r=r+1 elseif c=="8" then r=r+2 end end return r end, io.stdin:read("*l")))