System.in.eachLine{println it.grep(~/[0689]/).size+it.count("8")}