 Timer is Running

Count unset bits in a given Range
##### Submissions: 582   Accuracy: 30.1%   Difficulty: Easy   Marks: 2

Given a non-negative number n and two values l and r. The problem is to count the number of unset bits in the range l to r in the binary representation of n, i.e. to count unset bits from the rightmost lth bit to the rightmost rth bit.

Examples:

```Input : n = 42, l = 2, r = 5
Output : 2
(42)10 = (101010)2
There are '2' unset bits in the range 2 to 5.

Input : n = 80, l = 1, r = 4
Output : 4```

Input: The first line of the input contains a single integer T, denoting the number of test cases. ThenT test cases follow. Each test-case has one line of the input, the line contains three integers n, l and r.

Output:
Print the required output.

Constraints:
1 <= T <= 100
1 <= n,l,r <= 100000

Examples:
Input:

2
64 4 7
80 1 4

Output:
3
4

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: saksham0751

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.