while 1:print sum(397313/4**int(c)&3for c in raw_input())