3080: XOR

时间限制:500 ms 内存限制:128 MB
上传者:
提交:6 通过:2

题目描述

Exclusive or is a logical operation that outputs true only when inputs differ(one is true, the other is false). It is symbolized by the infix operators such as $XOR$, $\oplus$.

This time, brave $QQQ$ raises a problem to you. Given an interval [$l, r$], you need to calculate how many numbers $x$ between $l$ and $r$, where $x$ satisfies $x \oplus 4x \oplus 5x = 0$.

输入格式

The first line contains an integer number $T$ ($1 \leq T \leq 60$), the number of test cases.

$i^{th}$ of each next $T$ lines contains two integers $l$, $r$ ($1 \leq l \leq r \leq 10^{18}$).

输出格式

For each test case print the answer.

输入样例 复制

2
2 6
1 109

输出样例 复制

4
39