Given an integer n, find the maximum value of integer k such that the following condition holds: 

n & (n-1) & (n-2) & (n-3) & ... (k) = 0  where & denotes the [bitwise AND operation.](https://en.wikipedia.org/wiki/Bitwise_operation#AND)

Input

The first line contains a single integer t (1 ≤ t ≤ 3 ⋅ 10^4). Then t test cases follow.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^9).

Output

For each test case, output a single integer — the required integer k.

Example

Input


3
2
5
17


Output


1
3
15

Note

In the first testcase, the maximum value for which the continuous & operation gives 0 value, is 1.

In the second testcase, the maximum value for which the continuous & operation gives 0 value, is 3. No value greater then 3, say for example 4, will give the & sum 0. 

  * 5   \&   4 ≠ 0, 
  * 5   \&   4   \&   3 = 0. 



Hence, 3 is the answer.
import sys
import heapq
from collections import defaultdict
import re
import math
# sorted(l, key=lambda x: (x[1], -x[0])
# d=defaultdict(int)
# heapq.heapify(l)
# heapq.heappop(l)
# heapq.heappush(l,-1*b1)

def isPowerOfTwo(x):
  
    # First x in the below expression 
    # is for the case when x is 0 
    return (x and (not(x & (x - 1))) )
def binarygcd(a, b):
 
    # GCD(0, b) == b; GCD(a, 0) == a,
    # GCD(0, 0) == 0
    if (a == 0):
        return b
 
    if (b == 0):
        return a
 
    # Finding K, where K is the
    # greatest power of 2 that
    # divides both a and b.
    k = 0
 
    while(((a | b) & 1) == 0):
        a = a >> 1
        b = b >> 1
        k = k + 1
 
    # Dividing a by 2 until a becomes odd
    while ((a & 1) == 0):
        a = a >> 1
 
    # From here on, 'a' is always odd.
    while(b != 0):
 
        # If b is even, remove all
        # factor of 2 in b
        while ((b & 1) == 0):
            b = b >> 1
 
        # Now a and b are both odd. Swap if
        # necessary so a <= b, then set
        # b = b - a (which is even).
        if (a > b):
 
            # Swap u and v.
            temp = a
            a = b
            b = temp
 
        b = (b - a)
 
    # restore common factors of 2
    return (a << k)
def lcm(a,b):
    return (a/euclidgcd(a,b))*b
# use the coprime function it will call gcd and return 1 if gcd=1 else false
def euclidgcd(p,q):
# Create the gcd of two positive integers.
    while q != 0:
        p, q = q, p%q
    return p
def is_coprime(x, y):
    return euclidgcd(x, y) == 1
def isPrime(n) :
 
    # Corner cases
    if (n <= 1) :
        return False
    if (n <= 3) :
        return True
 
    # This is checked so that we can skip
    # middle five numbers in below loop
    if (n % 2 == 0 or n % 3 == 0) :
        return False
 
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
 
    return True



def nextPowerOf2(n):
 
    n -= 1
    n |= n >> 1
    n |= n >> 2
    n |= n >> 4
    n |= n >> 8
    n |= n >> 16
    n += 1
    return n


def binaryToDecimal(n):
    return int(n,2)    
def decimalToBinary(n):
    return bin(n).replace("0b", "")  

 
 
def isPerfectSquare(x):
 
    #if x >= 0,
    if(x >= 0):
        sr = math.sqrt(x)
        sr=int(sr)
        #return boolean T/F
        # print((sr*sr))
        return ((sr*sr) == x)
    return false      

def getSum(n1): 
     
    sum = 0
    cnt=0
    while (n1 != 0): 
        
        sum = sum + (n1% 10)
        n1 = n1//10
        cnt+=1
    return sum
def reducefract(n, d):
    '''Reduces fractions. n is the numerator and d the denominator.'''
    def gcd(n, d):
        while d != 0:
            t = d
            d = n%d
            n = t
        return n
    assert d!=0, "integer division by zero"
    assert isinstance(d, int), "must be int"
    assert isinstance(n, int), "must be int"
    greatest=gcd(n,d)
    n/=greatest
    d/=greatest
    return n, d       
# other functions

# sorted(l, key=lambda x: (x[1], -x[0])
# d=defaultdict(int)
# heapq.heapify(l)
# heapq.heappop(l)
# heapq.heappush(l,-1*b1)
from itertools import combinations
from functools import lru_cache
# @lru_cache(None)
import heapq
from collections import defaultdict
import re
import sys
import math
def solve(n):
    pass
    
input=sys.stdin.readline
# l=[] # string to list conversion
# l=s[::1]
t=int(input())
for i1 in range(t):
    # d=defaultdict()
    n=int(input())
    if isPowerOfTwo(n):
        print(n-1)
        continue
        
    k=nextPowerOf2(n)
    print(k//2-1)