Cow hooves have no fingers to speak of, so they count in binary instead of decimal. Of course, with only four hooves, they can't count so very high in normal binary.
They've devised a clever counting method, though. They stand on one to four of their legs after putting marks in the dirt. The marks represent binary 0's; their leg locations represent binary 1's. This means that they can represent numbers whose binary representation has four or fewer 1's.
Given a range of positive integers (both the start number and stop number are in the range 1..15,000,000), determine how many numbers in that range the cows can represent with four or fewer one bits.
* Line 1: Two space-separated numbers: the beginning and end of a range to be checked
* Line 1: The count of numbers in the range that can be represented by four or fewer 1's using binary arithmetic.
Num Binary Number of 1's Representable by cows?
100 1100100 3 Yes
101 1100101 4 Yes
102 1100110 4 Yes
103 1100111 5 No
104 1101000 3 Yes
105 1101001 4 Yes