while 1:print sum(int(s)>>i&1for s in raw_input().split('.')for i in range(8))