while 1:print sum(map(raw_input().count,'06889'))