#include<bits/stdc++.h>
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(0);
#define test  int tt; cin>>tt; for(int ii=0;ii<tt;ii++)
#define endl  "\n"
#define pb    push_back
#define D(x)  cout<<"#"<<x<<endl;
#define LL    long long
#define HI    cout<<endl<<"hi"<<endl;
using namespace std;


int main()
{
   fast
    test
    {
      LL n;
      cin>>n;
      LL t=log2(n);
      LL a=pow(2,t);
      cout<<a-1<<endl;
    }

    return 0;
}