**Waring**: This task was given by my professor who is 80 y/o and nobody understands what he sometimes wants, I do not expect more less standard approach to this problem, not just because the problem is difficult, but because my professor is old-school ex-ussr crazy guy ;) (he likes to make easy things complicated, just to explain why this is posted here)

This task is pure theory one, but I do not know how to formalize it with words
Problem:

> 
> 9 bits binary code is given on input, we have to print "0" in output
>  if amount of bits with value "1" are two times less than amount of
>  bits with value "0", if this condition is false that we have to print
>  "1" in output.
> 
> 
> 

What I proposed in my description is to introduce a counter, and then count bits that have value 1, then make an output based on this counter, but I was claimed to be an idiot and I was told that there's the way without the counter and I choose the hardest way. Does someone know the better way to determine what to output?

Thanks in advance, and sorry if description looks messy