Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L <= X <= R".Akku is genius, she solved the problem easily. Can you do it ??

**Input:**

The first line of input contains of an integer T i.e number of test cases. Next T lines contains two space seperated integers L,R

**Output:**

Output consists of T lines each indicating the answer for each test case.

**Constraints:**

1 <= T <= 10000

1 <= L <= R <= 10^18

**Example:**

Sample Input :

1

11 19

Sample Output :

4

**Explanation :**

There are 4 such numbers with 3 set bits in range 11 to 19.

11 -> 1011

13 -> 1101

14 -> 1110

19 -> 10011

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

devsinghindra | 80 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 443 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.