Company: Sprinkler
Difficulty: medium
Given a number N , you are required to convert it into a binary palindromic number . A binary palindromic number is a number whose binary representation is a palindrome. You can perform the following two operations on the provided number: Increase the value of the number by 1 . Decrease the value of the number by 1 . You are required to calculate the minimum number of operations required to convert the given number into a binary palindromic number. Note: the number must be represented using the minimum number of bits (ignoring the leading zeros in its binary representation). The value must stay positive at all times, so 0 is never a valid target. Input Format The first line contains T , the total number of test cases. Each of the next T lines contains an integer N , the number that must be converted into a binary palindromic number. Output Format For each test case, on a new line, print the minimum number of operations that are required to convert the number into a binary palindromic n