1351 -- Countable Numbers
Time Limit :1000 MS Memory Limit :65536 KB
Accepts : 31 Submits : 74
User Accepts : 22 User Submits : 27
<Submit>   <Statistics>   <Discuss>

Description

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. 

Input

* Line 1: Two space-separated numbers: the beginning and end of a range to be checked

Output

* Line 1: The count of numbers in the range that can be represented by four or fewer 1's using binary arithmetic.

Sample Input

100 105

Sample Output

5

Hint

OUTPUT DETAILS:
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
 
<Submit>   <Statistics>   <Discuss>
 


Powered by Zhang Zhaoning PDL College of Computer
Since 2006.03.09 | 2007.11.22 | 2010.03.02 Copyright (r) 2006 - 2010 All Rights Reserved