for(;;)print((readline().replace(/8/g,88).match(/[0689]/g)||[]).length)