You are given a number N. In one operation, you can either increase the value of N by 1 or decrease the value of N by 1.
Determine the minimum number of operations required (possibly zero) to convert number N to a number P such that binary representation of P is a palindrome.
Note: A binary representation is said to be a palindrome if it reads the same from left-right and right-left.
Input format
Output format
For each test case in a new line, print the minimum number of operations required.
Constraints
1≤T≤1050≤N≤2×109
For first test case
For second test case