while 1:print sum(sum(int(n)>>x&1 for x in range(8))for n in raw_input().split("."))