1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define pll pair<ll ,ll>
  4. using namespace std ;
  5. const ll z = 998244353 ;
  6.  
  7.  
  8. int main()
  9. {
  10.  
  11. ios_base::sync_with_stdio(0);
  12. cin.tie(0); cout.tie(0);
  13. #ifndef ONLINE_JUDGE
  14. freopen("inputf.txt" , "r" , stdin) ;
  15. freopen("outputf.txt" , "w" , stdout) ;
  16. freopen("error.txt" , "w" , stderr) ;
  17. #endif
  18.  
  19. int t ;
  20. cin >> t ;
  21.  
  22. while(t--)
  23. {
  24. int n ;
  25. cin >> n ;
  26.  
  27. ll ans = 0 ;
  28. for(int i = 32 ; i >= 0 ; i--)
  29. {
  30. if((((1LL) << i) & n) != 0)
  31. {
  32. ans = i ;
  33. break ;
  34. }
  35. }
  36. ll fin_ans = (n-1 - ans) ;
  37. cout << fin_ans << endl ;
  38. }
  39. return 0;
  40. }