Number of pairs
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Zenyk became interested in how many pairs of integers \((a, b)\) exist such that
\(l \le a \le b \le r\),
\(a + b = a \mbox{ XOR } b\).
Help Zenyk — calculate the answer for him.
Input
The single line contains two integers \(l\) and \(r\).
Output
In the single line, print an integer — the answer to the problem.
Constraints
\(0 \le l \le r \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 5 | 3 |
Notes
Pairs satisfying the condition in the example: (2, 4), (2, 5), (3, 4).
Source: NextGen Contest 1
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|