#include <bits/stdc++.h>
using namespace std;
# define ll long long

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    ll n;
	    cin>>n;
	    ll num=1;
	    int i=0;
	    while(num<=n)
	    {
	        num=(1<<i);
	        i++;
	    }
	    num=num>>1;
	    cout<<num-1<<endl;
	}
	return 0;
}
