a,b=0,0 for x in range(1,1001): bx=bin(x)[2:] c0=bx.count('0') c1=bx.count('1') if c1>c0: a+=1 else: b+=1 print(a,b)