题目描述
Problem Description
If the binary representation of a positive integer has each bit (either $0$ or $1$) with at least one identical bit to its left or right, Dr. X considers it a "lucky number." For example:
- $(1)_2 = (1)_{10}$ has a lone $1$, so it is not a lucky number.
- $(110111)_2 = (55)_{10}$ has a lone $0$, so it is not a lucky number.
- $(111110011)_2 = (499)_{10}$ is a lucky number.
- $(110011001100)_2 = (3276)_{10}$ is a lucky number.
For given integers $a$ and $b$, Dr. X wants you to find the number of lucky numbers in the range $a, a + 1, a + 2, \dots, b$.
Input Format
Input consists of two space-separated integers $a$ and $b$.
Output Format
Output a single integer representing the number of lucky numbers between $a$ and $b$.
Sample Input and Output
Sample Input #1
1 100
Sample Output #1
14
Sample Input #2
4096 65535
Sample Output #2
1364
Notes
For $100\%$ of the data, it is guaranteed that $1 \leq a \leq b \leq 10^6$.
The original full score for this problem was $15\text{pts}$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
1 100
样例输出
14