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 java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;


public class Main {

    static void solve() {
        Scanner scan = new Scanner(System.in);
        List<Integer> l = new ArrayList<>();
        l.add(0);
        l.add(1);
        int cnt = 0;
        int val = 1;
        while(cnt < 30) {
            val*=2;
            cnt++;
            l.add(val);
        }
        int t = scan.nextInt();
//        solveCaseA(n,k);
        for (int i = 0; i < t; i++) {
            int n = scan.nextInt();
            solveCaseA(n, l);
        }
//                solveCaseA(arr);
    }

    static void solveCaseA(int n, List<Integer> l) {
//        long res = 0;
//        System.out.println(res);
//        int res = 0;

        for (int i = l.size()-1; i>=0;i--) {
            if(l.get(i) <= n) {
                System.out.println(l.get(i) - 1);
                return;
            }
        }

//        System.out.println();
//        System.out.println(String.format("Case #%s: %.7f", c, ans));
    }


//    static boolean istPowerTwo(int n) {
//        if(n == 0) {
//            return true;
//        }
//        return (n & (n-1)) == 0;
//    }

    public static void main(String[] args) {
//        System.out.println(istPowerTwo(100));
        solve();
    }

    static class Pair {
        int beg;
        int end;

        public Pair(int beg, int end) {
            this.beg = beg;
            this.end = end;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Pair)) return false;
            Pair pair = (Pair) o;
            return (beg == pair.beg &&
                    end == pair.end) || (beg == pair.end && end == pair.beg);
        }

        @Override
        public int hashCode() {
            return Objects.hash(beg, end);
        }
    }

    static class Comp implements Comparator<Pair> {

        @Override
        public int compare(Pair p1, Pair p2) {
            if (p1.beg < p2.beg) {
                return -1;
            }
            if (p1.beg > p2.beg) {
                return 1;
            }
            if (p1.end < p2.end) {
                return -1;
            }
            if (p1.end > p2.end) {
                return 1;
            }
            return 0;
        }
    }

    //    static class TreeNode {
//        int val;
//        TreeNode left;
//        TreeNode right;
//
//        TreeNode(int x) {
//            val = x;
//        }
//    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
//    class Point implements Comparable<Point> {
//        int x;
//        int y;
//        Point(int x, int y) {
//            this.x = x;
//            this.y = y;
//        }
//
//        @Override
//        public int compareTo(Point o) {
//            double dist1 = Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));
//            double dist2 = Math.sqrt(Math.pow(o, 2) + Math.pow(o.y, 2));
//            if(dist1 < dist2) {
//                return 1;
//            }
//            if(dist1 > dist2) {
//                return -1;
//            }
//            return 0;
//        }
//    }

}